如何使用selenium-webdriver ruby​​代理?

时间:2016-11-25 06:57:22

标签: selenium selenium-webdriver

require "rubygems"
require "selenium"
require "selenium-webdriver"
require "selenium-proxy"

client = Selenium::WebDriver::Remote::Http::Default.new
client.proxy = Selenium::Proxy.new(:http => "proxify.com:8080")

driver = Selenium::WebDriver.for(:remote, :http_client => client)

获得以下错误:

proxy-test.rb:7:在`':未初始化的常量Selenium :: Proxy(NameError)

注意:我已经安装了

gem install selenium-webdriver

gem install selenium-proxy

selenium webdriver无需代理即可运行。当我使用代理时,得到 未初始化的常量Selenium :: Proxy(NameError)。

1 个答案:

答案 0 :(得分:-1)

Selenium :: WebDriver :: Proxy.new(http:PROXY)