5
votes

I am trying to make Ruby Watir script to run on a new server.
I have a working script on the old server:

#!/bin/ruby
require 'rubygems'
require 'watir'
require 'date'
require 'headless'
require 'fileutils'
require 'uri'
require 'logger'

headless = Headless.new(autopick: true, reuse: false, destroy_at_exit: true).start
options = Selenium::WebDriver::Chrome::Options.new
options.add_preference(:download, prefs)
options.add_argument('--ignore-certificate-errors')
options.add_argument('--disable-popup-blocking')
options.add_argument('--disable-translate')

b = Watir::Browser.new(:chrome, options: options)
b.goto 'someurl.com'
b.div(:id => 'IFRAME1').iframe.body.div(:id => 'DIVID1').div(class: ['Test1', 'Test2']).link(:id => 'DIVID2').click #getting warning here

The warning I am getting is the following:

WARN Selenium [DEPRECATION] Selenium::WebDriver::Error::ElementNotVisibleError is deprecated. Use Selenium::WebDriver::Error::ElementNotInteractableError (ensure the driver supports W3C WebDriver specification) instead.

Current server versions:

headless (2.3.1, 2.2.0)

selenium-webdriver (3.4.4)

watir (6.6.3)

New server versions:

headless (2.3.1)

selenium-webdriver (3.142.3, 3.142.0)

watir (6.16.5)

I have a feeling that the issue is with version mismatch, but I cannot pinpoint it.

So far I was not able to find any solution.

1

1 Answers

13
votes

TL/DR:

Do one of these three things:

  1. Ignore them, you're not doing anything wrong.
  2. Upgrade to Chrome v75+
  3. Downgrade to Selenium 3.141.0 for now

Selenium used to be implemented with JSON Wire Protocol, which detailed the driver endpoints and the formatting of the payload the endpoints expected, etc. Unfortunately, each browser driver implementation had its own interesting edge cases and peculiarities which made cross browser testing more challenging. Selenium developers and browser vendors got together to agree on a w3c standard for these interactions so that everything can be done in a way that works for all of the browsers. This standard was released in 2018 as a w3c recommendation. Google is the last browser vendor to turn on w3c compliance mode by default, and this will happen in Chrome v75 (which is getting released today).

Selenium 3.142 is the last version of Selenium before Selenium 4. Selenium 4 is going to remove support for the legacy protocol entirely. As such, the Ruby Selenium team decided to throw warnings in the code for anything that won't work in Selenium 4. Because Chrome < 75 does not comply with w3c by default, it will not work with Selenium 4 by default, so Selenium is throwing a warning. Note that this is an error as a result of the response from the driver, so there is nothing to change in your code to avoid this.