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开发者_Python百科 the browser in webdriver browser.maximize
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.
i had the same problem. I figured out the issue which was the anti-virus which was blocking the chrome driver to run as it automatically starts app. So if you put the exception to the antivirus such that it doesn't block chrome driver, it should work.
Hope that helps.
To solve the second question , you need to use browser.window.maximize
精彩评论