Google-chrome – Install Chrome Driver

google-chromewatirwatir-webdriver

  1. I've downloaded the chrome driver for Win 7 32-bit OS. On executing .exe file, a command prompt opens with the message Started ChromeDriver port=9515 I tried running this code, but chrome doesn't open…

    require "rubygems"
    require "watir-webdriver"
    #browser = Watir::Browser.new(:firefox) Firefox however opens
    #browser = Watir::Browser.new(:internet_explorer) IE too opens
    browser = Watir::Browser.new(:chrome)
    browser.goto "http://google.com"
    

I've only these two files bridge.rb and service.rb in the following folder: C:\Ruby187\lib\ruby\gems\1.8\gems\selenium-webdriver-0.2.0\lib\selenium\webdriver\chrome
Also, I've got the latest chrome installed 12.0.742.53

Question 2: This code doesn't maximize the browser in webdriver browser.maximize

Best Solution

You don't need to run the server manually. If chromedriver.exe is on your PATH, WebDriver will manage the server process for you.

If you want to manage the server yourself, you can still do that, but you'll need to create a :remote driver instead of :chrome:

Watir::Browser.new(:remote, :url => "http://localhost:9515")

If you're still having trouble, running your script with $DEBUG = true (or passing -d to Ruby on the command line) will give additional debug output.

You'll find more info about how the Chrome driver works here.

Related Question