Skip to content

Chrome browser automation

Daniel Gempesaw edited this page Aug 9, 2014 · 7 revisions

using protractor's webdriver-manager

I personally like using the webdriver-manager binary provided by the node package protractor. It can manage/update the standalone server as well as the IE and Chrome drivers and saves you having to worry about the PATHs of the different drivers. If you wish to use this method, the following should get you set up:

$ npm install -g protractor
$ webdriver-manager update --chrome --ie # ie flag is immaterial on OS X...
$ webdriver-manager start

automating chrome

  • Install the Chrome browser (in default location preferably)
  • Get the Chrome server from its download page. Look for a file named chromedriver_win_XXXX.zip, where XXXX is the version number (if you're not on windows, look for appropriately named file).
  • Extract chromedriver.exe in to the directory where your selenium-server-standalone jar file is.
  • cd to that directory in command line & type: java -Dwebdriver.chrome.driver="chromedriver.exe" -jar selenium-server-standalone-2.20.0.jar
  • In your script, pass 'browser_name' as 'chrome' for desired capabilities. for e.g.
my $driver = Selenium::Remote::Driver->new( browser_name => 'chrome');

handling ignore-certificate-errors warning

my $driver = Selenium::Remote::Driver->new(
    desired_capabilities => {
        chromeOptions => {
            excludeSwitches => [ 'ignore-certificate-errors' ]
        }
    }
);