Closed Bug 1493546 Opened Last year Closed Last year

event.synthesizeKey() fails when trying to uppercase a non-printable key

Categories

(Testing :: Marionette, defect, P1)

64 Branch
defect

Tracking

(firefox-esr60 unaffected, firefox62 unaffected, firefox63 unaffected, firefox64 fixed)

RESOLVED FIXED
mozilla64
Tracking Status
firefox-esr60 --- unaffected
firefox62 --- unaffected
firefox63 --- unaffected
firefox64 --- fixed

People

(Reporter: barancev, Assigned: whimboo)

References

(Blocks 1 open bug)

Details

(Keywords: regression)

Attachments

(2 files)

Attached file trace.log
User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36

Steps to reproduce:

Run Selenium script:

driver.get("http://seleniumhq.org/");
WebElement input = driver.findElement(By.id("q"));
input.sendKeys("nighti");
input.sendKeys(Keys.SHIFT, Keys.LEFT, "y");


Actual results:

[Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsITextInputProcessor.keydown]"  nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)"  location: "JS frame :: chrome://marionette/content/event.js :: event.synthesizeKey :: line 398"  data: no]

See the attached trace log.


Expected results:

A regression issue
Detected September 23, 2018 13:17:35 in Firefox Nightly by this job:
https://travis-ci.org/SeleniumHQ/selenium/jobs/432090523

Reproduced manually in version 64.0a1 (20180923100316) using the provided scenario.
Attachment #9011303 - Attachment mime type: text/x-log → text/plain
Here the important line from the log:

> 1537730225847	Marionette	TRACE	0 -> [0,5,"WebDriver:ElementSendKeys",{"id":"13db757f-6d2e-4580-bbec-33c0ca2b94c9","text":"y","value":["","","y"]}]
1

This should have been caused by my patch on bug 1405370. And the problematic key combination is `Keys.SHIFT + Keys.LEFT`.

A debug build of Firefox shows:

> [Child 24394, Main Thread] WARNING: 'aKeyboardEvent.mKeyNameIndex == KEY_NAME_INDEX_USE_STRING', file /builds/worker/workspace/build/src/dom/base/TextInputProcessor.cpp, line 1037

I haven't checked yet, but I think that we are now trying to uppercase ``, which is failing. I will check that tomorrow.
Assignee: nobody → hskupin
Blocks: 1405370
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression
Priority: -- → P1
Summary: Use of Keys.SHIFT in sendKeys causes "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsITextInputProcessor.keydown]" → "Webdriver:ElementSendKeys" fails with Keys.SHIFT in combination with other special characters
This is not only a problem for send keys but for any key action primitive:

>     ActionChains(driver) \
>         .key_down(Keys.SHIFT) \
>         .key_down(Keys.LEFT) \
>         .perform()

The problem is in this line where we are trying to uppercase any key which isn't a modifier key:

https://searchfox.org/mozilla-central/rev/881a3c5664ede5e08ee986d76433bc5c4b5680e6/testing/marionette/event.js#491

Instead this code only has to run if the key is printable.
Status: NEW → ASSIGNED
Summary: "Webdriver:ElementSendKeys" fails with Keys.SHIFT in combination with other special characters → event.synthesizeKey() fails when trying to uppercase a non-printable key
Comment on attachment 9011789 [details]
Bug 1493546 - Only uppercase printable keys when shift modifier is set. r?ato

Andreas Tolfsen ❲:ato❳ has approved the revision.
Attachment #9011789 - Flags: review+
Pushed by hskupin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1a24a41b377e
Only uppercase printable keys when shift modifier is set. r=ato
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/13215 for changes under testing/web-platform/tests
Upstream PR was closed without merging
Backout by nerli@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fa1e16a89825
Backed out changeset 1a24a41b377e for failures in test_navigation.py CLOSED TREE
So the try run which I did before making the requested changes was fine. I assume that one of the if blocks before the actual check causes a different path. And doing the printable job before all of them now, makes us fail.

As discussed with Andreas I will revert that, and we will see later how this could be refactored.
Pushed by hskupin@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/23601a34a9b2
Only uppercase printable keys when shift modifier is set. r=ato
https://hg.mozilla.org/mozilla-central/rev/23601a34a9b2
Status: ASSIGNED → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
You need to log in before you can comment on or make changes to this bug.