Getting error while executing selenium ide test case using .xml file - selenium-ide

[error] Unexpected Exception: [Exception... "The URI scheme corresponds to an unknown protocol handler"
nsresult: "0x804b0012 (NS_ERROR_UNKNOWN_PROTOCOL)"
location: "JS frame :: chrome://selenium-ide/content/tools.js ->
file:///D:/SeleniumTestCases/UserExtensions/include.js?1426324803395 :: IDEIncludeCommand.prototype.getIncludeDocumentBySynchronRequest :: line 82" data: no]. toString -> function toString() { [native code] },
message -> , result -> 2152398866, name -> NS_ERROR_UNKNOWN_PROTOCOL,
filename -> chrome://selenium-ide/content/tools.js ->
file:///D:/SeleniumTestCases/UserExtensions/include.js?1426324803395,
lineNumber -> 82, columnNumber -> 0, inner -> null, data -> null,
stack -> IDEIncludeCommand.prototype.getIncludeDocumentBySynchronRequest#chrome://selenium-ide/content/tools.js
-> file:///D:/SeleniumTestCases/UserExtensions/include.js?1426324803395:82:4
xmlTestData.prototype.load#chrome://selenium-ide/content/tools.js ->
file:///D:/SeleniumTestCases/UserExtensions/datadriven.js?1426324803392:54:21
Selenium.prototype.doLoadTestData#chrome://selenium-ide/content/tools.js
-> file:///D:/SeleniumTestCases/UserExtensions/datadriven.js?1426324803392:103:4
fnBind/retval#chrome://selenium-ide/content/selenium-core/scripts/htmlutils.js:60:11
ActionHandler.prototype.execute#chrome://selenium-ide/content/selenium-core/scripts/selenium-commandhandlers.js:314:27
._executeCurrentCommand#chrome://selenium-ide/content/selenium-runner.js:306:18
TestLoop.prototype.resume#chrome://selenium-ide/content/selenium-core/scripts/selenium-executionloop.js:78:12
fnBind/retval#chrome://selenium-ide/content/selenium-core/scripts/htmlutils.js:60:11
, location -> JS frame :: chrome://selenium-ide/content/tools.js ->
file:///D:/SeleniumTestCases/UserExtensions/include.js?1426324803395
:: IDEIncludeCommand.prototype.getIncludeDocumentBySynchronRequest ::
line 82
I included all js file in user-extension.js text box
like D:\SeleniumTestCases\UserExtensions\user-extension.js, D:\SeleniumTestCases\UserExtensions\sideflow.js,D:\SeleniumTestCases\UserExtensions\datadriven.js, D:\SeleniumTestCases\UserExtensions\include.js
I referred my test case by How can I read variables from data pool with selenium IDE

sounds like improper xml file attempting to be loaded.
What is the selenium code causing this? how is the url written?

Related

how to use prevent default on Elm Browser.Event.onKeyDown

Please Note: I could not a find a solution that could work here, so I used ports for the same.
I need to use Browser.Events.onKeyDown for which I have also written a decoder, I need to create some shortcuts for my web app thus I need to prevent default behavior of Meta key (on Mac) and Ctrl key (on other Os)
In my Subscription method I am using the following.
But there is no exposed way of using prevent Default.
let
decoder : Decode.Decoder Msg
decoder =
keyDecoder
|> Decode.andThen
(\( keyCode, ctrlKey ) ->
case keyCode of
39 ->
Decode.succeed <| ShortCutNext
37 ->
Decode.succeed <| ShortCutPrevious
_ ->
Decode.fail ""
)
in
Sub.batch
[ Browser.Events.onKeyDown decoder]
keyDecoder : Decode.Decoder ( Int, Bool )
keyDecoder =
Decode.map2 (\a -> \b -> ( a, b ))
(Decode.field "keyCode" Decode.int)
(Decode.field "metaKey" Decode.bool)
Note: The event is on the page itself and not on any element such as textarea thus Html.Events.custom "keydown" options decoder is not applicable.

Elm How to make custom event decoder to get mouse x/y position at mouse-wheel-move

I am trying to get the x and y coordinates of the mouse during a mouse-wheel-move event in the Elm 0.19 programming language.
I attempt it with this package. See under "Advanced Usage":
https://package.elm-lang.org/packages/mpizenberg/elm-pointer-events/3.1.0/Html-Events-Extra-Wheel
The package itself did not describe a clear example so I looked for an example in a similar package.
See the example under "advanced usage" in this page:
https://package.elm-lang.org/packages/mpizenberg/elm-pointer-events/3.1.0/Html-Events-Extra-Mouse
This example is very similar to what I need, but I can also not get this to work. Get exactly the same problem.
Here is my code adapted from the example to fit with mouse wheel:
module WheelDecoder exposing(..)
import Html exposing (div, text)
import Html.Events.Extra.Wheel as Wheel
import Json.Decode as Decode
type alias WheelEventWithOffsetXY =
{ wheelEvent : Wheel.Event
, offsetXY : {x: Float, y: Float}
}
decodeWeelWithOffsetXY : Decode.Decoder WheelEventWithOffsetXY
decodeWeelWithOffsetXY =
Decode.map2 WheelEventWithOffsetXY
Wheel.eventDecoder
offsetXYDecoder
offsetXYDecoder : Decode.Decoder {x: Float, y: Float}
offsetXYDecoder =
Decode.map2 (\a b -> {x=a,y=b})
(Decode.field "offsetY" Decode.float)
(Decode.field "offsetY" Decode.float)
type Msg
= WheelOffsetXY {x: Float, y: Float}
view =
div
[ (onWheelOffsetXY (\wheelEvent -> WheelOffsetXY (wheelEvent.offsetXY))) ]
[ (text "mousewheel here") ]
onWheelOffsetXY : (WheelEventWithOffsetXY -> msg) -> Html.Attribute msg
onWheelOffsetXY tag =
let
options = { stopPropagation = True, preventDefault = True }
func = Decode.map tag decodeWeelWithOffsetXY
attribute = Wheel.onWithOptions options func
in
attribute
When I try to compile with "elm make" I get the following error:
-- TYPE MISMATCH -------------------------------------- src/Map/WheelDecoder.elm
The 2nd argument to `onWithOptions` is not what I expect:
39| attribute = Wheel.onWithOptions options func
^^^^
This `func` value is a:
Decode.Decoder msg
But `onWithOptions` needs the 2nd argument to be:
Wheel.Event -> msg
Hint: I always figure out the argument types from left to right. If an argument
is acceptable, I assume it is “correct” and move on. So the problem may actually
be in one of the previous arguments!
This error message makes sense as I can see there is a type mismatch, but I have no clue about how to solve it.
It seems like Wheel.eventDecoder was meant to work with Html.Events.on or Html.Events.onWithOptions rather than Wheel.onWithOptions. These were removed in 0.19 in favor of Html.Events.custom, however, which is slightly different. Replacing onWheelOffsetXY with this seems to work:
onWheelOffsetXY : (WheelEventWithOffsetXY -> msg) -> Html.Attribute msg
onWheelOffsetXY tag =
let
options message =
{ message = message
, stopPropagation = True
, preventDefault = True
}
decoder =
decodeWeelWithOffsetXY
|> Decode.map tag
|> Decode.map options
in
Html.Events.custom "wheel" decoder
PS: There's a typo in decodeWeelWithOffsetXY, btw. I've left the typo in place.
PPS: Also, you're looking at outdated documentation. Here's the documentation for the latest version.

Fake deploy package issue

I'm new at FAKE and I'm trying to use fake as continuous delivery, but I'm faced with a problem with deploying my .nupkg files. Here is the code of my DeployPackage target
Target "DeployPackages" (fun _ ->
deployProjects
|> Seq.iter (fun projName ->
deploymentMachines
|> Seq.iter (fun machineUrl ->
let package = Directory.GetFiles(deployDir, projName + "*.nupkg").FirstOrDefault()
if package = String.Empty
then failwith "No packages was found. You should get green build before deployment."
else
package |> deployToMachine(machineUrl)
)
)
)
and in TeamCity build log I see error:
"Finished Target: CreateDeploymentPackage
Starting Target: DeployPackages (==> CreateDeploymentPackage, CreateDeploymentPackage)
Target: DeployPackages
..\Build\output\deploy\MySitev2.65.nupkg"
AND then the next error message "Newtonsoft.Json.JsonSerializationException:
No union type found with the name 'Message'. Path 'case', line 2, position 20.
at Newtonsoft.Json.Converters.DiscriminatedUnionConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
[15:35:09][Step 2/2] at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
[15:35:09][Step 2/2] at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Fake.FakeDeployAgentHelper.processResponse(Byte[] response) in D:\code\fake\src\app\Fake.Deploy.Lib\FakeDeployAgentHelper.fs:line 120"
Whats wrong with my target?

Freemarker using Map values with macro

I'm using a Freemarker macro for managing the content of two maps.
<#macro MACRO_NAME v>
<#nested v.val, v.msg>
</#macro>
Fruit map is structured like this
Map("fruits" -> Map("val", Map("banana" -> "yellow, "orange" -> "orange"), "msg" -> null))
And the other map, animals, looks like this
Map("animals" -> Map("insects" -> Map("butterflies" -> Map("val" -> Map("Hasora anura" -> "blue", Hasora badra -> "yellow"), "msg" -> null))))
It is ok if val is null, because I've a check in my Freemarker code. If fruits.val is null the following code will output false, false (the correct behavior)
${fruits.val???c}
<#MACRO_NAME fruits; fu, fuMsg>
${fu???c}
</#MACRO_NAME>
${animals.insects.butterflies.val???c}
<#MACRO_NAME animals.insects.butterflies; butterflies, buMsg>
${butterflies???c}
</#MACRO_NAME>
But my Problem is that if animals.insects.butterflies.val is null, this will output false, true but it should be false, false too.
I've have no idea why this happens.
wow a really weird behavior I think
the answer is: never, never name the loop var like your map key.
<#MACRO_NAME animals.insects.butterflies; bu, buMsg> instead of
<#MACRO_NAME animals.insects.butterflies; butterflies, buMsg> will work...
it was just a naming problem.

Haskell Snap: mongodb field type error

I get an error which I can't resolve.
The snap application compiles without a problem and everything seems to be ok.
But when I render the relevant page in a browser I get this error:
A web handler threw an exception. Details:
expected ("code" :: Integer) in [ _id: 50b56f19208c2e9a09dccc2b, id: 1.0, code: "hdg435", name: "froggy"]
The code value is just a rendom string I picked for testing. I am not sure why an integer is expected?
These are the relevant parts of an example snap application.
getData :: IO [Document]
getData = do
pipe <- runIOE $ connect $ host "127.0.0.1"
let run act = access pipe master "test" act
result <- run (find (select [] "pcs") >>= rest)
close pipe
return $ either (const []) id result
mkSplice :: Document -> Splice AppHandler
mkSplice d = runChildrenWithText [dtp "id" d
,dtp "code" d
,dtp "name" d
]
dtp :: Text -> Document -> (Text,Text)
dtp tag d = (tag, T.pack $ show $ at tag d)
recSplice :: Splice AppHandler
recSplice = mapSplices mkSplice =<< liftIO getData
table :: Handler App App ()
table = heistLocal (bindSplice "rec" recSplice) $ render "table"
The relevant Heist template part of table.tpl is here:
<table>
<tbody>
<rec>
<tr><td><id/></td><td><code/></td><td><name/></td></tr>
</rec>
</tbody>
</table>
Please let me know what other parts of code need to be posted.
When I compile your dtp function I get:
import Data.Bson
import Data.Text (Text)
import qualified Data.Text as T
dtp :: Text -> Document -> (Text,Text)
dtp tag d = (tag, T.pack $ show $ at tag d)
Ambiguous type variable `a0' in the constraints:
(Show a0)
[...]
which makes perfect sense. It seems like in your case it's defaulting to Integer when you really want String. You can try adding a signature or better yet, just:
dtp tag d = (tag, at tag d)
If you want this to work for other types, you'll have to work harder.
UPDATE
Here's a GHCi session that illustrates the problem and how GHCi seems to default the Show instance to Integer:
Prelude Data.Bson> show $ at "hello" ["hello" =: "world"]
"*** Exception: expected ("hello" :: Integer) in [ hello: "world"]