0
votes

I'm running automated tests using Ruby/Cucumber/Capybara/Chromedriver, but i get an error while running a simple test scenario. I tried to solve problem by updating version of Ruby, Capybara, Cucumber, Chromdriver and Chrome. I need your help. Here is the details:

Try to: visit 'http://www.google.com'

Getting: WARNING: The formatter Teamcity::Cucumber::Formatter is using the deprecated formatter API which will be removed in v4.0 of Cucumber.

2018-04-16 14:32:43 WARN Selenium [DEPRECATION] :args or :switches is deprecated. Use Selenium::WebDriver::Chrome::Options#add_argument instead.

Net::ReadTimeout: Net::ReadTimeout ./features/step_definitions/common_steps.rb:46:in `/^testing$/'

Chrome Version:65.0.3325.181 Chrome Driver: 2.37 cucumber: 3.1.0 capybara: 3.0.1 ruby: 2.2.6

When I removed "--disable-extensions" from env.rb file as you see below it works fine..

Capybara::Selenium::Driver.new(app, :browser => :chrome, :switches => %w[--disable-extensions --disable-web-security --start-maximized])

2
What version of selenium-webdriver are you using because the driver registration you posted works fine for me (other than the deprecation warning about :switches).Thomas Walpole

2 Answers

0
votes

Capybara::Selenium::Driver.new(
  app,browser: :chrome,
      desired_capabilities: {
      'chromeOptions' => {
         'useAutomationExtension' => false,
         'args' => ['--disable-web-security', '--start-maximized', '--disable-infobars']
      }
   }
)
0
votes
 client = Selenium::WebDriver::Remote::Http::Default.new
 client.read_timeout = 120

 Capybara.register_driver :headless_chrome do |app|
    capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
      chromeOptions: {args: %w[headless disable-gpu disable-popup-blocking window-size=10_000,1080 log-level=3]}
    )
    Capybara::Selenium::Driver.new(app,
                                   browser: :chrome,
                                   desired_capabilities: capabilities,
                                   http_client: client)
  end