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

[rb] - Minor - Specific Error type not initialized #8875

Closed
luke-hill opened this issue Nov 16, 2020 · 9 comments
Closed

[rb] - Minor - Specific Error type not initialized #8875

luke-hill opened this issue Nov 16, 2020 · 9 comments
Labels

Comments

@luke-hill
Copy link
Contributor

🐛 Bug Report

0> Selenium::WebDriver::Error::ServerError
=> uninitialized constant Selenium::WebDriver::Error::ServerError
Did you mean?  Selenium::WebDriver::Error::WebDriverError

This error is thrown in a few places. Primarily when the webdriver connection is timed out during debug phase or a few other areas (Such as using the new experimental JS - See other issue)

To Reproduce

Just try throw the error above. It will say it doesn't recognise it.

Expected behavior

The error exists

Test script or set of commands reproducing this issue

driver = Selenium::WebDriver.for :chrome
driver.get('www.google.com')
raise Selenium::WebDriver::Error::ServerError

Environment

OS: Bionic 18.04
Browser: Chrome/Firefox in remote
Browser version: 83/79
Browser Driver version: Valid
Language Bindings version: Alpha6 Ruby
Selenium Grid version (if applicable): Alpha 6

@ghost ghost added the needs-triaging label Nov 16, 2020
@luke-hill
Copy link
Contributor Author

File location / method invocation
selenium/webdriver/remote/response

        def assert_ok
          e = error
          raise e if e
          return unless @code.nil? || @code >= 400

          raise Error::ServerError, self
        end

@titusfortner
Copy link
Member

This is getting autoloaded only in the contexts in which it is needed
https://github.com/SeleniumHQ/selenium/blob/trunk/rb/lib/selenium/webdriver/remote.rb#L28

You shouldn't be able to call it from outside those contexts, so we need to know more about the context in which you are seeing the error. Can you reference the other issues you are referring to?

@luke-hill
Copy link
Contributor Author

So two instances I call it both trigger it.

#1 - Using some experimental JS - I'm still not able to fully reproduce this yet (The new window.navigator stuff)
#2 - Place a debug point in RubyMine, wait for a minute for BS to terminate, then try perform an action, i.e. call element.click

@titusfortner
Copy link
Member

I think this is working as expected. In order to use the error, you would need to put the experimental js inside a context that allows the error to be used.

I'd need to see a stack trace for your RubyMine error, but, obviously, you shouldn't be able to call a click on an element when the driver has been closed. :) It's probably a capybara issue. ;-)

@yalab
Copy link

yalab commented Aug 18, 2021

It wasn't Capybara's fault.
I don't know if it's the driver or the server.

The following code will reproduce it.

# test.rb

require 'selenium-webdriver'

driver = Selenium::WebDriver.for :remote, url: "http://localhost:4444/", capabilities: {browser_name: 'chrome'}
driver.navigate.to "http://google.com"
# docker-compose.yml

version: '3.4'
services:
  selenium:
    image: selenium/standalone-chrome:4.0.0-rc-1-prerelease-20210804
    ports:
      - "4444:4444"
# Gemfile

source 'https://rubygems.org'

gem 'selenium-webdriver', '~> 4.0.0.beta4'

Thanks.

@titusfortner
Copy link
Member

Yes, I was joking about it being a Capybara issue. Can you provide a stack trace for this? Not sure how it can get this error with the code you provided.

@luke-hill
Copy link
Contributor Author

I mentioned previously @titusfortner that if you generate a timeout and the connection has died then this error will be thrown

@titusfortner
Copy link
Member

Aha, the error is in a file in the remote directory, but not namespaced with Remote, so autoload doesn't work. Just switched it to require the file instead, it'll work in next release.

@github-actions
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 Sep 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants