在gem 安装完watir-webdriver后,默认情况下chrome浏览器的支持是没有安装上的。
所以如果要使用webdriver测试chrome的话,我们需要手动安装chrome支持。
引用
Requirements
The ChromeDriver controls the browser using Chrome’s automation proxy framework. Consequently, the ChromeDriver is only compatible with Chrome version 12.0.712.0 or newer.
The ChromeDriver controls the browser using Chrome’s automation proxy framework. Consequently, the ChromeDriver is only compatible with Chrome version 12.0.712.0 or newer.
从官方文档上可以看出,chrome driver只支持chrome12.0712以上的版本。
万事俱备后,首先下载chrome driver
将下载好的chromedriver.exe放在环境变量所配置的文件夹中。
使用下面的代码测试chrome driver是否安装完成:
#使用watir-webdriver语法 #安装成功后则可以启动chrome并打开腾讯首页 @browser = Watir::Browser.new :chrome @browser.goto 'www.qq.com'
1 楼
springxu
2012-06-19
谢谢。刚开始了解 watir webdriver .正在找怎么调用chrome的问题。 按你方法,问题解决。