Chrome

ChromeDriver

你可以通过下载与平台相关的ChromeDriver的二进制文件来获得Chrome浏览器的支持。 ChromeDriver的下载地址见这里

b = Watir::Browser.new :chrome

Chrome Profiles

profile = Selenium::WebDriver::Chrome::Profile.new
profile['download.prompt_for_download'] = false
profile['download.default_directory'] = "/path/to/dir"

b = Watir::Browser.new :chrome, :profile => profile

详细的profile选项请参见这里

Chrome的开关

b = Watir::Browser.new :chrome, :switches => %w[--ignore-certificate-errors --disable-popup-blocking --disable-translate]

详细的开关选项参加这里

在Chrome中使用代理

b = Watir::Browser.new :chrome, :switches => %w[--proxy-server=myproxy.com:8080]

Published: July 06 2013

blog comments powered by Disqus