Use Watir-WebDriver behind proxy

来源:互联网 发布:尼格罗人种知乎 编辑:程序博客网 时间:2024/05/18 20:50
Good Ruby script#!/usr/bin/ruby def create_firefox_profile    profile = Selenium::WebDriver::Firefox::Profile.new    profile['network.proxy.ftp']           = "proxy.foo.com"    profile['network.proxy.ftp_port']      = 80    profile['network.proxy.http']          = "proxy.foo.com"    profile['network.proxy.http_port']     = 80    profile['network.proxy.no_proxies_on'] = "localhost, 127.0.0.1, *.foo.com"    profile['network.proxy.ssl']           = "proxy.foo.com"    profile['network.proxy.ssl_port']      = 80    profile['network.proxy.type']          = 1    profileend require 'watir-webdriver'ENV['no_proxy'] = '127.0.0.1' b = Watir::Browser.new :firefox, :profile => create_firefox_profileb.goto 'http://www.google.com'


Bad Ruby script#!/usr/bin/ruby require 'watir-webdriver'profile = Selenium::WebDriver::Firefox::Profile.newprofile.proxy = Selenium::WebDriver::Proxy.new :http => 'proxy.foo.com:80', :ssl => 'proxy.foo.com:80'browser = Watir::Browser.new :firefox, :profile => profile

from: http://tech.danbarrese.com/2013/04/08/solved-use-watir-webdriver-behind-proxy/


http://docs.seleniumhq.org/docs/04_webdriver_advanced.jsp#parallelizing-your-test-runs

原创粉丝点击