question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SendKeys does not unescape double-slash

See original GitHub issue

Repro steps: Use Element.SendKeys to enter a string including a single slash, e.g. “foo/bar”

Expected: WinAppDriver correctly enters foo\bar

Actual: WinAppDriver enters foo\\bar

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
HSARcommented, Aug 23, 2017

Aha - it doesn’t repro with the US keyboard.

Code executed: tb.SendKeys("`-=[]\\;',./~!@#$%^&*()_+{}|:\"<>? abcd \\\\ \\£ £ ££");

Result in text box: `-=[]\;',./~!@#$%^&*()_+{}|:"<>? abcd \\ \£ £ ££

Screenshot: image

[WinAppDriver] [STDOUT] ==========================================
[WinAppDriver] [STDOUT] POST /wd/hub/session/ED30BC1A-AB0F-4808-BC6D-53A3BAE5731D/element/42.22875568/value HTTP/1.1
[WinAppDriver] [STDOUT] Accept: */*
[WinAppDriver] [STDOUT] Connection: keep-alive
[WinAppDriver] [STDOUT] Content-Length: 71
[WinAppDriver] [STDOUT] Content-Type: application/json
[WinAppDriver] [STDOUT] Host: 127.0.0.1:4724
[WinAppDriver] [STDOUT] User-Agent: appium
[WinAppDriver] [STDOUT]
[WinAppDriver] [STDOUT] {"value":["`-=[]\\;',./~!@#$%^&*()_+{}|:\"<>? abcd \\\\ \\£ £ ££"]}
[WinAppDriver] [STDOUT] HTTP/1.1 200 OK
[WinAppDriver] [STDOUT] Content-Length: 63
[WinAppDriver] [STDOUT] Content-Type: application/json
[WinAppDriver] [STDOUT]
[WinAppDriver] [STDOUT] {"sessionId":"ED30BC1A-AB0F-4808-BC6D-53A3BAE5731D","status":0}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"ED30BC1A-AB0F-4808-BC6D-53A3BAE5731D","status":0}
[JSONWP Proxy] Replacing sessionId ED30BC1A-AB0F-4808-BC6D-53A3BAE5731D with 5e3505f1-b586-4519-b83f-69a8760f4d3f
[HTTP] <-- POST /wd/hub/session/5e3505f1-b586-4519-b83f-69a8760f4d3f/element/42.22875568/value 200 3627 ms - 63
[HTTP] --> GET /wd/hub/session/5e3505f1-b586-4519-b83f-69a8760f4d3f/element/42.22875568/text {}
[MJSONWP] Driver proxy active, passing request on via HTTP proxy
[debug] [JSONWP Proxy] Proxying [GET /wd/hub/session/5e3505f1-b586-4519-b83f-69a8760f4d3f/element/42.22875568/text] to [GET http://127.0.0.1:4724/wd/hub/session/ED30BC1A-AB0F-4808-BC6D-53A3BAE5731D/element/42.22875568/text] with body: {}
[WinAppDriver] [STDOUT]
[WinAppDriver] [STDOUT]
[WinAppDriver] [STDOUT] ==========================================
[WinAppDriver] [STDOUT] GET /wd/hub/session/ED30BC1A-AB0F-4808-BC6D-53A3BAE5731D/element/42.22875568/text HTTP/1.1
[WinAppDriver] [STDOUT] Accept: */*
[WinAppDriver] [STDOUT] Connection: keep-alive
[WinAppDriver] [STDOUT] Content-Type: application/json
[WinAppDriver] [STDOUT] Host: 127.0.0.1:4724
[WinAppDriver] [STDOUT] User-Agent: appium
[WinAppDriver] [STDOUT]
[WinAppDriver] [STDOUT]
[WinAppDriver] [STDOUT] HTTP/1.1 200 OK
[WinAppDriver] [STDOUT] Content-Length: 131
[WinAppDriver] [STDOUT] Content-Type: application/json
[WinAppDriver] [STDOUT]
[WinAppDriver] [STDOUT] {"sessionId":"ED30BC1A-AB0F-4808-BC6D-53A3BAE5731D","status":0,"value":"`-=[]\\;',./~!@#$%^&*()_+{}|:\"<>? abcd \\\\ \\£ £ ££"}
[debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"ED30BC1A-AB0F-4808-BC6D-53A3BAE5731D\",\"status\":0,\"value\":\"`-=[]\\\\;',./~!@#$%^&*()_+{}|:\\\"<>? abcd \\\\\\\\ \\\\£ £ ££\"}"
1reaction
HSARcommented, Sep 7, 2017

Following up a feature request as a result of this - it would be very handy if WinAppDriver could switch the device into en-US keyboard layout at the start, and (possibly) switch back to the pre-test keyboard layout at the end.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SendKeys does not unescape double-slash · Issue #217
Repro steps: Use Element.SendKeys to enter a string including a single slash, e.g. "foo/bar" Expected: WinAppDriver correctly enters foo\bar ...
Read more >
Selenium Webdriver using Java - sendkeys with double slash
1 Answer 1 ... Try the code like this (Assuming you want the output as 'test\\'): driver.findElement(By.id("txtEditExcludeRegPath")).sendKeys(" ...
Read more >
Using SendKeys
SendKeys does not permit you to set the foreground window, ... Double-click the button in the designer to add a Click event.
Read more >
SendKeys.Send(String) Method (System.Windows.Forms)
There is not an active application to send keystrokes to. ... When the example is running, double-click the form to trigger the button's...
Read more >
SendKeys Class (System.Windows.Forms)
The SendKeys class is susceptible to timing issues, which some developers have had to work around. The updated implementation is still susceptible to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found