Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keyDown(Keys.SHIFT) not considered for sendKeys() #944

Open
codingphil opened this issue Sep 12, 2017 · 4 comments
Open

keyDown(Keys.SHIFT) not considered for sendKeys() #944

codingphil opened this issue Sep 12, 2017 · 4 comments

Comments

@codingphil
Copy link

System

  • Version: 0.18
  • Platform: Windows 10 Creators Update
  • Firefox: 57.0a1 (2017-09-12) (64-Bit)
  • Selenium: 3.5.3 (Java)

Testcase

After calling Actions.keyDown(Keys.SHIFT) it is expected that the following sendKeys() call considers the pressed SHIFT key and uppercases all lower case characters passed to sendKeys() but actually the pressed SHIFT key is just ignored. See the Selenium JUnit test below.

  @Test
  public void testKeyDownShift_sendKeys_keyUpShift_textIsUppercase() {
    // given
    webDriver.navigate().to("http://localhost/SimpleTextField.html");
    WebElement textFieldElem = webDriver.findElementByName("textfield");
    assertEquals("", textFieldElem.getAttribute("value"));
    textFieldElem.click();
    
    // when
    new Actions(webDriver).keyDown(Keys.SHIFT).sendKeys("abc").keyUp(Keys.SHIFT).perform();
    
    // then
    assertEquals("ABC", textFieldElem.getAttribute("value")); // <<=== FAILS
  }

Stacktrace

org.junit.ComparisonFailure: expected:<[ABC]> but was:<[abc]>
	at org.junit.Assert.assertEquals(Assert.java:115)
	at org.junit.Assert.assertEquals(Assert.java:144)
	at SendKeysTests.testKeyDownShift_sendKeys_keyUpShift_textIsUppercase(SendKeysTests.java:439)

Trace-level log

geckodriver-log.txt

@codingphil
Copy link
Author

The used HTML page:
SimpleTextField.html.zip

@mjzffr
Copy link
Contributor

mjzffr commented Oct 3, 2017

I was able to reproduce this.

Strangely enough, Marionette does synthesize events that look right (i.e. the shift property on the event object is true when we expect it to be true) but that doesn't actually cause the browser to produce capitalized letters in the input field, apparently. =/

Details at: https://bugzilla.mozilla.org/show_bug.cgi?id=1405370

@Trucnt

This comment has been minimized.

@whimboo
Copy link
Collaborator

whimboo commented Aug 23, 2018

As long as the before-mentioned bug is not fixed, it doesn't help us when you add me too comments. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants