Closed mlipok closed 1 year ago
UserTesting_EscapeString.au3
changed
REPRO SCRIPT updated, and require: https://github.com/Danp2/au3WebDriver/pull/464
REPRO SCRIPT updated, and require: https://github.com/Danp2/au3WebDriver/pull/464
Please don't do this in the future. You could have easily reproduced this without requiring another PR.
Taking a look at the two options for _WD_SetElementValue --
$_WD_OPTION_Standard
calls _WD_ElementAction
, which formats the string with __WD_EscapeString
$_WD_OPTION_Advanced
calls _WD_ExecuteScript
, which formats the script with __WD_EscapeString
, but not the argumentsI wonder if there would be any undesirable effects if we updated _WD_ExecuteScript
to format the arguments. 🤔
Do you plan to resolve this ISSUE with me ... before you release new version ? Or release will not necessarily be related with this issue.
As you can see from #468, my plan is to release the update tomorrow. Currently, we haven't decided on the best method to address this issue. Any fix most likely won't make the next release because --
I wonder if there would be any undesirable effects if we updated _WD_ExecuteScript to format the arguments.
Based upon some basic tests, I can conclude that it would not be safe to format the arguments of _WD_ExecuteScript.
__WD_Post: URL=HTTP://127.0.0.1:4444/session/6d16a944-058c-40df-bac9-5951fb54fecc/execute/sync; Data={"script":"return arguments[0].second;", "args":[{"first": "1st", "second": "2nd", "third": "3rd"}]}
__WD_Post ==> Success [0] : HTTP status = 200 ResponseText={"value":"2nd"}
_WD_ExecuteScript ==> Success [0]
__WD_Post: URL=HTTP://127.0.0.1:4444/session/30b6951c-dc25-43c6-85ba-9c7d19d7e381/execute/sync; Data={"script":"return arguments[0].second;", "args":[{\"first\": \"1st\", \"second\": \"2nd\", \"third\": \"3rd\"}]}
__WD_Post ==> Invalid argument [5] : HTTP status = 400 ResponseText={"value":{"error":"invalid argument","message":"Failed to decode request as JSON: {\"script\":\"return arguments[0].second;\", \"args\":[{\\\"first\\\": \\\"1st\\\", \\\"second\\\": \\\"2nd\\\", \\\"third\\\": \\\"3rd\\\"}]}","stacktrace":"Syntax error at :1:51"}}
_WD_ExecuteScript ==> Invalid argument [5] : Failed to decode request as JSON: {"script":"return arguments[0].second;", "args":[{\"first\": \"1st\", \"second\": \"2nd\", \"third\": \"3rd\"}]}
I believe the existing functionality works as-is, and formatting of data, if required, should occur prior to calling _WD_SetElementValue. My recommendation is to add an entry in the remarks section of the header to document the situation.
Bug report
Describe the bug
_WD_SetElementValue()
in$_WD_OPTION_Advanced
mode does not use any StringEscape action on $sValue https://github.com/Danp2/au3WebDriver/blob/f00d0d6a62f101fb2e8ff184750bdb05baefcfa2/wd_helper.au3#L2617-L2624How to reproduce
check with:
wd_demo.au3
:UserFile
:Using file:
UserTesting_EscapeString.au3
with following content:results:
Expected behavior
String should be escaped the same way as
$_WD_OPTION_Standard
(internally in_WD_ElementAction
)Screenshots
none
Additional context
none
System under test
not related