titusfortner / webdrivers

Keep your Selenium WebDrivers updated automatically
MIT License
593 stars 111 forks source link

Selenium 4 Alpha - Webdrivers not auto-updating with require call #175

Closed luke-hill closed 4 years ago

luke-hill commented 4 years ago

Summary

I've come back to do some coding. And webdrivers is pinning chromedriver to v71

Debug Info

Please provide the following information for bug reports:

Expected Behavior

Browser to run

Actual Behavior

Browser error on <Selenium::WebDriver::Error::WebDriverError: no sessionId in returned payload>

Possible issue is that webdrivers is currently permitting 4.0.0.alpha versions. Not sure if it's tested with those. The issue is only with the alpha versions, and selenium 3.142.x seems fine.

Note that 4.0.0.alphaN is < 4.0

kapoorlakshya commented 4 years ago

@luke-hill That's odd. Can you please set Webdrivers.logger.level = :DEBUG before launching the browser and share the logs here?

luke-hill commented 4 years ago

Done. I ran it again, there's a heap of debug statements in this travis run

First line ref is here: https://travis-ci.com/github/site-prism/site_prism/jobs/343475950#L819

EDIT: You can see here: https://github.com/site-prism/site_prism/pull/57/checks?check_run_id=737568482 that essentially all the tests run fine on the other Gemfiles, the only failures occur (wholly), on Gemfile.alpha - There are a couple of sporadic failures do to coding issues I need to fix on fast rubies/browsers (chrome 2.6/2.7), where I need to alter the timeouts of a test. But other than that, it's only this change that forces the issue.

kapoorlakshya commented 4 years ago

@luke-hill Based on the logs you shared, webdrivers is successfully downloading a compatible chromedriver build version 83.0.4103.x for your Chrome build version 83.0.4103.x:

2020-06-04 07:56:27 DEBUG Webdrivers Browser version: 83.0.4103.97
2020-06-04 07:56:27 DEBUG Webdrivers making System call: ["/usr/bin/google-chrome", "--product-version"]
2020-06-04 07:56:27 DEBUG Webdrivers System call returned: 83.0.4103.97
2020-06-04 07:56:28 DEBUG Webdrivers making System call: ["/home/travis/.webdrivers/chromedriver", "--version"]
2020-06-04 07:56:28 DEBUG Webdrivers System call returned: ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103@{#416})

This tells me that what you're experiencing seems to be an issue between Selenium 4 and chromedriver's interaction. I haven't been keeping up with the changes in Selenium 4 to accurately tell you what exactly is going on, but please consider opening a ticket there. Another thing you can try is downgrading to Chrome 81 or 82 and see if it makes a difference.

luke-hill commented 4 years ago

Any advice you have for now? As this is running through travis and is affecting us releasing a CI upgrade to our gem support. Should we for now not support selenium4 alpha?

luke-hill commented 4 years ago

cc/ @p0deje could you shed some light alex? Maybe this is something you could help/advise on

p0deje commented 4 years ago

I cannot reproduce the problem using 4.0 alpha. This is the test script I used:

requirer 'bundler/inline'

gemfile do
  source 'https://rubygems.org'

  gem 'selenium-webdriver', '4.0.0.alpha5'
  gem 'webdrivers', '4.4.1'
end

require 'selenium-webdriver'
require 'webdrivers'

Selenium::WebDriver.logger.level = :debug
Webdrivers.logger.level = :DEBUG

Selenium::WebDriver.for(:chrome)&.quit
$ ruby test.rb
/Users/p0deje/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/selenium-webdriver-4.0.0.alpha5/lib/selenium/webdriver/common/driver.rb:46: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/Users/p0deje/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/selenium-webdriver-4.0.0.alpha5/lib/selenium/webdriver/common/driver.rb:74: warning: The called method `initialize' is defined here
/Users/p0deje/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/selenium-webdriver-4.0.0.alpha5/lib/selenium/webdriver/common/driver.rb:76: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/Users/p0deje/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/selenium-webdriver-4.0.0.alpha5/lib/selenium/webdriver/common/driver.rb:297: warning: The called method `create_bridge' is defined here
2020-06-23 05:21:20 DEBUG Webdrivers Checking current version
2020-06-23 05:21:20 DEBUG Webdrivers /Users/p0deje/.webdrivers/chromedriver is not already downloaded
2020-06-23 05:21:20 DEBUG Webdrivers making System call: ["//Applications/Google Chrome.app/Contents/MacOS/Google Chrome", "--version"]
2020-06-23 05:21:20 DEBUG Webdrivers System call returned: Google Chrome 83.0.4103.106

2020-06-23 05:21:20 DEBUG Webdrivers Browser version: Google Chrome 83.0.4103.106
2020-06-23 05:21:20 DEBUG Webdrivers Checking current version
2020-06-23 05:21:20 DEBUG Webdrivers /Users/p0deje/.webdrivers/chromedriver is not already downloaded
2020-06-23 05:21:20 DEBUG Webdrivers making System call: ["//Applications/Google Chrome.app/Contents/MacOS/Google Chrome", "--version"]
2020-06-23 05:21:20 DEBUG Webdrivers System call returned: Google Chrome 83.0.4103.106

2020-06-23 05:21:20 DEBUG Webdrivers Browser version: Google Chrome 83.0.4103.106
2020-06-23 05:21:20 DEBUG Webdrivers making System call: ["//Applications/Google Chrome.app/Contents/MacOS/Google Chrome", "--version"]
2020-06-23 05:21:20 DEBUG Webdrivers System call returned: Google Chrome 83.0.4103.106

2020-06-23 05:21:20 DEBUG Webdrivers Browser version: Google Chrome 83.0.4103.106
2020-06-23 05:21:20 DEBUG Webdrivers Making network call to https://chromedriver.storage.googleapis.com/LATEST_RELEASE_83.0.4103
2020-06-23 05:21:20 DEBUG Webdrivers Get response: #<Net::HTTPOK 200 OK readbody=true>
2020-06-23 05:21:20 DEBUG Webdrivers Latest version available: 83.0.4103.39
2020-06-23 05:21:20 DEBUG Webdrivers Deleting /Users/p0deje/.webdrivers/chromedriver.version
2020-06-23 05:21:20 DEBUG Webdrivers making System call: ["//Applications/Google Chrome.app/Contents/MacOS/Google Chrome", "--version"]
2020-06-23 05:21:20 DEBUG Webdrivers System call returned: Google Chrome 83.0.4103.106

2020-06-23 05:21:20 DEBUG Webdrivers Browser version: Google Chrome 83.0.4103.106
2020-06-23 05:21:20 DEBUG Webdrivers Checking current version
2020-06-23 05:21:20 DEBUG Webdrivers /Users/p0deje/.webdrivers/chromedriver is not already downloaded
2020-06-23 05:21:20 DEBUG Webdrivers making System call: ["//Applications/Google Chrome.app/Contents/MacOS/Google Chrome", "--version"]
2020-06-23 05:21:20 DEBUG Webdrivers System call returned: Google Chrome 83.0.4103.106

2020-06-23 05:21:20 DEBUG Webdrivers Browser version: Google Chrome 83.0.4103.106
2020-06-23 05:21:20 DEBUG Webdrivers making System call: ["//Applications/Google Chrome.app/Contents/MacOS/Google Chrome", "--version"]
2020-06-23 05:21:20 DEBUG Webdrivers System call returned: Google Chrome 83.0.4103.106

2020-06-23 05:21:20 DEBUG Webdrivers Browser version: Google Chrome 83.0.4103.106
2020-06-23 05:21:20 DEBUG Webdrivers Making network call to https://chromedriver.storage.googleapis.com/LATEST_RELEASE_83.0.4103
2020-06-23 05:21:20 DEBUG Webdrivers Get response: #<Net::HTTPOK 200 OK readbody=true>
2020-06-23 05:21:20 DEBUG Webdrivers Latest version available: 83.0.4103.39
2020-06-23 05:21:20 DEBUG Webdrivers chromedriver URL: https://chromedriver.storage.googleapis.com/83.0.4103.39/chromedriver_mac64.zip
2020-06-23 05:21:20 DEBUG Webdrivers Making network call to https://chromedriver.storage.googleapis.com/83.0.4103.39/chromedriver_mac64.zip
2020-06-23 05:21:20 DEBUG Webdrivers Get response: #<Net::HTTPOK 200 OK readbody=true>
2020-06-23 05:21:20 DEBUG Webdrivers Successfully downloaded /var/folders/3s/yybq9c5n4pd0z9t4phtp6ml00000gn/T/20200623-73366-16rg2kychromedriver_mac64.zip
2020-06-23 05:21:20 DEBUG Webdrivers Decompressing /var/folders/3s/yybq9c5n4pd0z9t4phtp6ml00000gn/T/20200623-73366-16rg2kychromedriver_mac64.zip
2020-06-23 05:21:21 DEBUG Webdrivers Completed download and processing of /Users/p0deje/.webdrivers/chromedriver
2020-06-23 05:21:21 DEBUG Selenium Executing Process ["/Users/p0deje/.webdrivers/chromedriver", "--port=9515"]
2020-06-23 05:21:21 DEBUG Selenium polling for socket on ["127.0.0.1", 9515]
2020-06-23 05:21:21 DEBUG Selenium polling for socket on ["127.0.0.1", 9515]
2020-06-23 05:21:21 DEBUG Selenium polling for socket on ["127.0.0.1", 9515]
Starting ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103@{#416}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
2020-06-23 05:21:21 INFO Selenium -> POST session
2020-06-23 05:21:21 INFO Selenium    >>> http://127.0.0.1:9515/session | {"capabilities":{"firstMatch":[{"browserName":"chrome"}]}}
2020-06-23 05:21:21 DEBUG Selenium      > {"Accept"=>"application/json", "Content-Type"=>"application/json; charset=UTF-8", "User-Agent"=>"selenium/4.0.0.alpha5 (ruby macosx)", "Content-Length"=>"58"}
2020-06-23 05:21:23 INFO Selenium <- {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"83.0.4103.106","chrome":{"chromedriverVersion":"83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103@{#416})","userDataDir":"/var/folders/3s/yybq9c5n4pd0z9t4phtp6ml00000gn/T/.com.google.Chrome.EDu6fp"},"goog:chromeOptions":{"debuggerAddress":"localhost:59384"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"mac os x","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","webauthn:virtualAuthenticators":true},"sessionId":"a2b06bafb9f18cf5a85ef922b2527ff9"}}
2020-06-23 05:21:23 INFO Selenium -> DELETE session/a2b06bafb9f18cf5a85ef922b2527ff9
2020-06-23 05:21:23 INFO Selenium <- {"value":null}

According to logs, the Webdrivers downloaded ChromeDriver and told Selenium to use it correctly.

luke-hill commented 4 years ago

Ok, I'll try on alpha5 (Previously I used alpha4) in my repo again. If that fails again for the same reason I'll try do an in-line ruby script like you did. There will be differences as I'm using site_prism (I'll try remove cucumber).

Maybe it's some interop with some other gems, but I'm using a reasonably common stack (Capybara/Cucumber)

luke-hill commented 4 years ago

Ignore me PEBKAC - The issue is I was creating the payload with w3c set to false.

When setting the selenium webdriver logger to debug I get this

2020-06-23 11:19:30 INFO Selenium <- {"sessionId":"550ba3701972511900474d7d820d4835","status":33,"value":{"message":"session not created: Missing or invalid capabilities\n  (Driver info: chromedriver=83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103@{#416}),platform=Linux 4.15.0-106-generic x86_64)"}}