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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[馃悰 Bug]: Build failing: NoMethodError: undefined method `command_list' for #<Selenium::WebDriver::Remote::Bridge #13307

Closed
giladshanan opened this issue Dec 14, 2023 · 7 comments

Comments

@giladshanan
Copy link

What happened?

I'm using the selenium/standalone-chrome image to run JS specs via teaspoon for an open source project:
https://github.com/tablexi/nucore-open

The specs run via Github Actions, referencing the latest image tag. Last week builds started failing.
I can get specs running again by pinning the image to an older tag:
selenium/standalone-chrome:119.0.6045.199-chromedriver-119.0.6045.105

I opened an issue over there as well, and they recommended I reach out here:
SeleniumHQ/docker-selenium#2052

The log output indicates NoMethodError: undefined method command_list' for #<Selenium::WebDriver::Remote::Bridge`, which makes me think this may be related to:
#12037

Perhaps there are some additional changes needed to config options to get this working properly with the latest version of selenium/standalone-chrome?

How can we reproduce the issue?

Command used to start Selenium Grid with Docker (or Kubernetes)
bundle exec rake teaspoon
Relevant log output
bundle exec rake teaspoon
  shell: sh -e {0}
  env:
    TEASPOON_RAILS_ENV: test
    RAILS_ENV: test
    MYSQL_HOST: mysql
    MYSQL_USER: root
    MYSQL_PASSWORD: root
    SELENIUM_HOST: selenium
    SELENIUM_PORT: 4444
    TEST_APP_PORT: 3000

Relevant log output

Starting the Teaspoon server...
Teaspoon running default suite at http://172.18.0.2:3000/teaspoon/default
rake aborted!
NoMethodError: undefined method `command_list' for #<Selenium::WebDriver::Remote::Bridge:0x00007fa3a3ddfb78 @http=#<Selenium::WebDriver::Remote::Http::Default:0x00007fa3a427cbb8 @open_timeout=nil, @read_timeout=120, @server_url=#<URI::HTTP http://selenium:4444/wd/hub/>, @proxy=nil, @http=#<Net::HTTP selenium:4444 open=true>>, @file_detector=#<Proc:0x00007fa3a3db4090 /__w/nucore-open/nucore-open/vendor/bundle/ruby/3.1.0/gems/selenium-webdriver-4.15.0/lib/selenium/webdriver/remote/driver.rb:39 (lambda)>, @session_id="19a093407a2d1f99df35684aed5b0816", @capabilities=#<Selenium::WebDriver::Remote::Capabilities:0x00007fa3a3db6638 @capabilities={:timeouts=>{:implicit=>0, :page_load=>300000, :script=>30000}, :browser_name=>"chrome-headless-shell", :browser_version=>"120.0.6099.62", :platform_name=>"linux", :accept_insecure_certs=>false, :page_load_strategy=>"normal", :set_window_rect=>true, :unhandled_prompt_behavior=>"dismiss and notify", :strict_file_interactability=>false, "chrome"=>{"chromedriverVersion"=>"120.0.6099.62 (93ab19d804d479b507c4694305631dfb65f8e930-refs/branch-heads/6099_56@{#3})", "userDataDir"=>"/tmp/.org.chromium.Chromium.ezAmuU"}, "fedcm:accounts"=>true, "goog:chromeOptions"=>{"debuggerAddress"=>"localhost:42557"}, "networkConnectionEnabled"=>false, "se:bidiEnabled"=>false, "se:cdp"=>"ws://172.18.0.4:4444/session/19a093407a2d1f99df35684aed5b0816/se/cdp", "se:cdpVersion"=>"120.0.6099.62", "se:vnc"=>"ws://172.18.0.4:4444/session/19a093407a2d1f99df35684aed5b0816/se/vnc", "se:vncEnabled"=>true, "se:vncLocalAddress"=>"ws://172.18.0.4:7900", "webauthn:extension:credBlob"=>true, "webauthn:extension:largeBlob"=>true, "webauthn:extension:minPinLength"=>true, "webauthn:extension:prf"=>true, "webauthn:virtualAuthenticators"=>true}>, @browser=:"chrome-headless-shell">

          command_list = @bridge.command_list
                                ^^^^^^^^^^^^^
/__w/nucore-open/nucore-open/vendor/bundle/ruby/3.1.0/gems/selenium-webdriver-4.15.0/lib/selenium/webdriver/remote/driver.rb:40:in `initialize'
/__w/nucore-open/nucore-open/vendor/bundle/ruby/3.1.0/gems/selenium-webdriver-4.15.0/lib/selenium/webdriver/common/driver.rb:57:in `new'
/__w/nucore-open/nucore-open/vendor/bundle/ruby/3.1.0/gems/selenium-webdriver-4.15.0/lib/selenium/webdriver/common/driver.rb:57:in `for'
/__w/nucore-open/nucore-open/vendor/bundle/ruby/3.1.0/gems/selenium-webdriver-4.15.0/lib/selenium/webdriver.rb:89:in `for'
/__w/nucore-open/nucore-open/vendor/bundle/ruby/3.1.0/gems/teaspoon-1.4.0/lib/teaspoon/driver/selenium.rb:26:in `run_specs'
/__w/nucore-open/nucore-open/vendor/bundle/ruby/3.1.0/gems/teaspoon-1.4.0/lib/teaspoon/console.rb:56:in `run_specs'
/__w/nucore-open/nucore-open/vendor/bundle/ruby/3.1.0/gems/teaspoon-1.4.0/lib/teaspoon/console.rb:45:in `block in execute_without_handling'
/__w/nucore-open/nucore-open/vendor/bundle/ruby/3.1.0/gems/teaspoon-1.4.0/lib/teaspoon/console.rb:43:in `each'
/__w/nucore-open/nucore-open/vendor/bundle/ruby/3.1.0/gems/teaspoon-1.4.0/lib/teaspoon/console.rb:43:in `inject'
/__w/nucore-open/nucore-open/vendor/bundle/ruby/3.1.0/gems/teaspoon-1.4.0/lib/teaspoon/console.rb:43:in `execute_without_handling'
/__w/nucore-open/nucore-open/vendor/bundle/ruby/3.1.0/gems/teaspoon-1.4.0/lib/teaspoon/console.rb:28:in `execute'
/__w/nucore-open/nucore-open/vendor/bundle/ruby/3.1.0/gems/teaspoon-1.4.0/lib/teaspoon/console.rb:24:in `failures?'
/__w/nucore-open/nucore-open/vendor/bundle/ruby/3.1.0/gems/teaspoon-1.4.0/lib/tasks/teaspoon.rake:14:in `block in <main>'
/__w/nucore-open/nucore-open/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/exe/rake:27:in `<top (required)>'
/usr/local/bundle/gems/bundler-2.3.11/lib/bundler/cli/exec.rb:58:in `load'
/usr/local/bundle/gems/bundler-2.3.11/lib/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/bundle/gems/bundler-2.3.11/lib/bundler/cli/exec.rb:23:in `run'
/usr/local/bundle/gems/bundler-2.3.11/lib/bundler/cli.rb:483:in `exec'
/usr/local/bundle/gems/bundler-2.3.11/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/bundle/gems/bundler-2.3.11/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/bundle/gems/bundler-2.3.11/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/usr/local/bundle/gems/bundler-2.3.11/lib/bundler/cli.rb:31:in `dispatch'
/usr/local/bundle/gems/bundler-2.3.11/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/usr/local/bundle/gems/bundler-2.3.11/lib/bundler/cli.rb:25:in `start'
/usr/local/bundle/gems/bundler-2.3.11/exe/bundle:48:in `block in <top (required)>'
/usr/local/bundle/gems/bundler-2.3.11/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
/usr/local/bundle/gems/bundler-2.3.11/exe/bundle:36:in `<top (required)>'
/usr/local/bundle/bin/bundle:25:in `load'
/usr/local/bundle/bin/bundle:25:in `<main>'
Tasks: TOP => teaspoon
(See full trace by running task with --trace)
Error: Process completed with exit code 1.

Operating System

ubuntu

Selenium version

Ruby 3.1.1

What are the browser(s) and version(s) where you see this issue?

Chrome 120.0.6099.71

What are the browser driver(s) and version(s) where you see this issue?

Chrome 120.0.6099.71

Are you using Selenium Grid?

No response

Copy link

@giladshanan, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@titusfortner
Copy link
Member

This is likely breaking because --headless now uses chrome-headless-shell and Selenium is trying to dynamically add additional features based on the browser name returned. We at the very least should have a better error message for this.

I don't know where in your code or the library you are using that --headless is getting set, but we highly encourage people to switch to using --headless=new

Also can you run this with Selenium::WebDriver.logger.level = :debug or $DEBUG=true so I can verify this is the cause?

@dnes100
Copy link

dnes100 commented Dec 18, 2023

Hi @titusfortner , could this be because command_list method is called before loading WebDriver::Remote::Features in here: https://github.com/SeleniumHQ/selenium/blob/trunk/rb/lib/selenium/webdriver/remote/driver.rb#L40C11-L41C54
since command_list method is defined in Features module?

@titusfortner
Copy link
Member

My tests are all passing. I need a (minimal) reproducible example that shows this error.

@titusfortner
Copy link
Member

Oh, I see what it is. If for some reason the browser name is not recognized, it doesn't load a custom feature file, and for /reasons/ we need to call it the method before we load the remote feature file. Merged

@dnes100
Copy link

dnes100 commented Dec 22, 2023

Sorry I didn't get your previous comment before. I just verified that new headless option worked for me:

options = Selenium::WebDriver::Chrome::Options.new
options.add_argument('--headless=new')

Thanks!

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants