Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
866 views
by Contributing Tester (92 points)
edited by
require 'watir'

cr_caps = {
  browser_name: 'chrome',
  chromeOptions: { args: [ '--proxy-server=127.0.0.1:9999' ] }
}

browser = Watir::Browser.new(
  :remote,
  url: 'http://127.0.0.1:4444/wd/hub',
  desired_capabilities: cr_caps
)
browser.goto 'https://google.com/'
sleep 5
browser.close
Getting exception:
[remote server] org.openqa.selenium.remote.server.DefaultDriverFactory(DefaultDriverFactory.java):62:in `newInstance': The best matching driver provider org.openqa.selenium.ie.InternetExplorerDriver can't create a new driver instance for Capabilities [{browser_name=chrome, chromeOptions={args=[--proxy-server=127.0.0.1:9999]}}] (Selenium::WebDriver::Error::UnknownError)
Internet Explorer driver is creating a session but should be 'Chrome'.

I am not sure why IE exception is coming anyways/

1 Answer

1 like 0 dislike
by
Its throwing error because you have configured Internet Explorer to open, but in your script, you are trying to invoke chrome.

You have to set your ​cr_caps with correct browser_name.


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...