Skip to content
New issue

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

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

Already on GitHub? # to your account

Failures with Chrome 44 (but not Chrome 43 or lower) #213

Closed
dsnopek opened this issue Jul 24, 2015 · 7 comments
Closed

Failures with Chrome 44 (but not Chrome 43 or lower) #213

dsnopek opened this issue Jul 24, 2015 · 7 comments

Comments

@dsnopek
Copy link

dsnopek commented Jul 24, 2015

I don't know exactly whose bug this is - whether it's Chrome, chromedriver, Selenium, or MinkSelenium2Driver - but let's start here. :-)

So, we have a Behat and Selenium test suite that works perfectly with Chrome 43 and below, but fails with Chrome 44.

Specifically, what appears to be happening is that a Behat step is calling $element->fillField('name', 'username'); but what is getting filled in in the browser is "username " (with what appears to be a tab character at the end, but it could just be a bunch of spaces).

Here is a minimalist .feature file for Behat that shows the problem:

Feature: Testing Chrome 43
  In order to use Chrome 43
  As a user
  I need to be able to fill in fields

  @api @javascript @chrome
  Scenario: I fill in a field on the login page
    Given I visit "/user/#"
    When I fill in "name" with "username"
    Then the "name" field should contain "username"

And here's what I get as output when I run it:

Feature: Testing Chrome 43
  In order to use Chrome 43
  As a user
  I need to be able to fill in fields

  @api @javascript @chrome
  Scenario: I fill in a field on the login page     # features/chrome43.feature:7
    Given I visit "/user/#"                     # Drupal\DrupalExtension\Context\MinkContext::assertAtPath()
    When I fill in "name" with "username"           # Drupal\DrupalExtension\Context\MinkContext::fillField()
    Then the "name" field should contain "username" # Drupal\DrupalExtension\Context\MinkContext::assertFieldContains()
      The field "name" value is "username       ", but "username" expected. (Behat\Mink\Exception\ExpectationException)

--- Failed scenarios:

    features/chrome43.feature:7

1 scenario (1 failed)
3 steps (2 passed, 1 failed)
0m2.15s (56.94Mb)

And this test passes when I downgrade to Chrome 43 or use Goutte instead of Selenium.

For completeness, here's the versions of stuff I'm using:

  • Chrome 44.0.2403.89 (64-bit) under Linux
  • chromdriver 2.16
  • Selenium 2.46
  • Behat 3.0.15
  • behat/mink 1.6.1
  • behat/mink-extension 2.0.1
  • behat/mink-selenium2-driver 1.2.0

Please let me know what you think! If you think this should be moved down the chain to other issue queues, like Chrome or Selenium, I can do that! However, it'll be a little harder for me to describe the problem to them since I don't know exactly how their APIs are being used, since I'm using them through Behat and Mink. :-)

Thanks in advance for your help!

@aik099
Copy link
Member

aik099 commented Jul 24, 2015

Can you please create & run PHP code snippet, that would just to the fillField by directly calling Mink?

@dsnopek
Copy link
Author

dsnopek commented Jul 24, 2015

Sure! Here's a gist with PHP code using Mink directly that demonstrates the failure in my testing:

https://gist.github.com/dsnopek/58a621ece44ca624a702

@dsnopek
Copy link
Author

dsnopek commented Jul 24, 2015

Looking at the code in Selenium2Driver, it does appear to be adding a tab at the end of the value:

https://github.com/minkphp/MinkSelenium2Driver/blob/master/src/Selenium2Driver.php#L662

If I remove the . Key::TAB bit on that line, then it works for me! So, I think this might actually a bug in this project...

@dsnopek
Copy link
Author

dsnopek commented Jul 24, 2015

Hrm, or maybe the bug is with Chrome starting to incorrectly put tab characters into the field? I'm not exactly sure how to articulate this to the Chrome project, but looking at the WebDriver wire protocol:

https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value

It seems pretty clear that this is about keypresses, not string values, so sending the value for TAB should be like pressing the TAB key not injecting the value...

@dsnopek
Copy link
Author

dsnopek commented Jul 24, 2015

I created an issue in the Chrome queue just in case:

https://code.google.com/p/chromium/issues/detail?id=513728&thanks=513728&ts=1437753911

Hopefully that's the right place and not chromedriver? I guess we'll see depending on how they respond. :-)

@taisph
Copy link

taisph commented Jul 28, 2015

I can reproduce this without Selenium by pointing Behat directly at Chromedriver.

@dsnopek
Copy link
Author

dsnopek commented Jul 29, 2015

The above mentioned Chrome issue been merged into this other Chrome issue:

https://code.google.com/p/chromium/issues/detail?id=513768

It sounds like the place in the code where this is messed up has been located!

So, I think this squarely seems like "not a bug in MinkSelenium2Driver" so closing. :-) Thanks everyone for responding and following!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants