question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ArgumentError: wrong number of arguments (given 1, expected 0) # /usr/local/bundle/gems/selenium-webdriver-3.142.7/lib/selenium/webdriver/remote/bridge.rb:44:in `handshake

See original GitHub issue

I have the following capybara config:

Capybara.register_driver :chrome_headless do |app|
  media_tab_screen_size = '1280,800'
  chrome_capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
    loggingPrefs: {
      browser: 'ALL',
      client: 'ALL',
      driver: 'ALL',
      server: 'ALL'
    },
    chromeOptions: {
      args: %W[no-sandbox
               disable-dev-shm-usage
               no-default-browser-check
               start-maximized
               headless
               disable-gpu
               window-size=#{media_tab_screen_size}]
    }
  )
  if ENV['HUB_URL']
    Capybara::Selenium::Driver.new(app,
                                   browser: :remote,
                                   url: ENV['HUB_URL'],
                                   desired_capabilities: chrome_capabilities)
  else
    Capybara::Selenium::Driver.new(app,
                                   browser: :chrome,
                                   desired_capabilities: chrome_capabilities)
  end
end

RSpec.configure do |config|

    driven_by :chrome_headless

    # Sets host for tests with selenium
    Capybara.app_host = "http://#{IPSocket.getaddress(Socket.gethostname)}:3000"
    # Capybara.server = :puma # Until your setup is working
    Capybara.server_host = IPSocket.getaddress(Socket.gethostname)
    Capybara.server_port = 3000
end

When I am running a system test, I am getting the following error:

          ArgumentError:
            wrong number of arguments (given 1, expected 0)
          # /usr/local/bundle/gems/selenium-webdriver-3.142.7/lib/selenium/webdriver/remote/bridge.rb:44:in `handshake'
          # /usr/local/bundle/gems/selenium-webdriver-3.142.7/lib/selenium/webdriver/remote/driver.rb:39:in `initialize'
          # /usr/local/bundle/gems/selenium-webdriver-3.142.7/lib/selenium/webdriver/common/driver.rb:58:in `new'
          # /usr/local/bundle/gems/selenium-webdriver-3.142.7/lib/selenium/webdriver/common/driver.rb:58:in `for'
          # /usr/local/bundle/gems/selenium-webdriver-3.142.7/lib/selenium/webdriver.rb:88:in `for'
          # /usr/local/bundle/gems/capybara-3.35.3/lib/capybara/selenium/driver.rb:83:in `browser'
          # /usr/local/bundle/gems/capybara-3.35.3/lib/capybara/selenium/driver.rb:104:in `visit'
          # /usr/local/bundle/gems/capybara-3.35.3/lib/capybara/session.rb:278:in `visit'
          # /usr/local/bundle/gems/capybara-3.35.3/lib/capybara/dsl.rb:53:in `call'
          # /usr/local/bundle/gems/capybara-3.35.3/lib/capybara/dsl.rb:53:in `visit'
          # ./spec/system/home_page_spec.rb:7:in `block (2 levels) in <top (required)>'
          # /usr/local/bundle/gems/webmock-3.11.2/lib/webmock/rspec.rb:37:in `block (2 levels) in <main>'

     1.2) Failure/Error:
                    def self.handshake(**opts)
                      desired_capabilities = opts.delete(:desired_capabilities) { Capabilities.new }

                      if desired_capabilities.is_a?(Symbol)
                        unless Capabilities.respond_to?(desired_capabilities)
                          raise Error::WebDriverError, "invalid desired capability: #{desired_capabilities.inspect}"
                        end

                        desired_capabilities = Capabilities.__send__(desired_capabilities)
                      end

          ArgumentError:
            wrong number of arguments (given 1, expected 0)

I really don’t know what is causing this. I tried to debug it myriad times and change the gem version but nothing happened. I would appreciate any help.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:5

github_iconTop GitHub Comments

2reactions
joelcommented, Mar 23, 2021

Okay I see you’ve posted here https://stackoverflow.com/questions/66285725 I’m indeed in Ruby 3.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

ruby on rails - Wrong number of arguments (given 1, expected 0)
Wrong number of arguments (given 1, expected 0) - ArgumentError in CommerceController#receive. This is the new controller and actions:.
Read more >
ArgumentError: wrong number of arguments (given 1 ... - GitHub
When overriding same method in awesome_print without this default parameter, the error is raised.
Read more >
wrong number of arguments (given 1, expected 0) : r/rails
Hi. I am not sure what is throwing this error. My code is https://ibb.co/k1DmTH . The final end is the one that closes...
Read more >
wrong number of arguments (given 1, expected 0 ...
When I run my test I get following error: wrong number of arguments (given 1, expected 0) (ArgumentError)
Read more >
Class: ArgumentError (Ruby 2.7.0)
Ex: passing the wrong number of arguments [1, 2, 3].first(4, 5). raises the exception: ArgumentError: wrong number of arguments (given 2, expected 1)....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found