2
votes

I tried following code

crawler = Capybara::Session.new(:selenium)
crawler.visit "https://twitter.com" # Error this line!

with

gem:
  capybara (= 2.2.0)
  selenium-webdriver (3.3.0)
WebBrowser:
  FireFoex53.0
OS:
  Mac OSX

then got following Error

TypeError: can't dup NilClass

[stack trace]
gems/selenium-webdriver-3.3.0/lib/selenium/webdriver/remote/w3c_capabilities.rb:101:in `dup'",
gems/selenium-webdriver-3.3.0/lib/selenium/webdriver/remote/w3c_capabilities.rb:101:in `json_create'",
gems/selenium-webdriver-3.3.0/lib/selenium/webdriver/remote/w3c_bridge.rb:116:in `create_session'",
gems/selenium-webdriver-3.3.0/lib/selenium/webdriver/remote/w3c_bridge.rb:76:in `initialize'",
gems/selenium-webdriver-3.3.0/lib/selenium/webdriver/firefox/w3c_bridge.rb:45:in `initialize'",
gems/selenium-webdriver-3.3.0/lib/selenium/webdriver/common/driver.rb:52:in `new'",
gems/selenium-webdriver-3.3.0/lib/selenium/webdriver/common/driver.rb:52:in `for'",
gems/selenium-webdriver-3.3.0/lib/selenium/webdriver.rb:87:in `for'",
gems/capybara-2.2.0/lib/capybara/selenium/driver.rb:13:in `browser'",
gems/capybara-2.2.0/lib/capybara/selenium/driver.rb:45:in `visit'",
gems/capybara-2.2.0/lib/capybara/session.rb:197:in `visit'"

url "https://twitter.com" is working when I manualy visit on this FireFox browser.

but capybara's visit method is does't work..

1
Capybara 2.2 is over 3 years old - Update to the current release. Also for FF 53 you want selenium-webdriver 3.4.x and geckodriver 0.16.1Thomas Walpole
@ThomasWalpole update gems then resolved! very thanks.user3812919

1 Answers

1
votes

I ran into this error (TypeError: can't dup NilClass) when trying to use the selenium-webdriver gem as instructed:

require "selenium-webdriver"

driver = Selenium::WebDriver.for :firefox

As suggested by Thomas, updating the selenium-webdriver gem number from 3.3.x to 3.4.x resolves the issue.