ruby-robotの夢

cygwin-ruby,qgisの達人を目指す奮闘記

Ruby Selenium Webdriver fFreFox on Linux

最新版に対応した日本語記事が不足していたので、書いてみた。
これでlinuxで動かせるようになった。

require 'selenium-webdriver'
PROXY='*.*.*.*:8002'
profile = Selenium::WebDriver::Firefox::Profile.new
profile.proxy = Selenium::WebDriver::Proxy.new(
  :http     => PROXY,
  :ftp      => PROXY,
  :ssl      => PROXY
)
@wait_time = 60 #sec
@timeout = 10 #sec
options = Selenium::WebDriver::Firefox::Options.new(profile: profile)
driver = Selenium::WebDriver.for :firefox, :options => options  #chrome
driver.manage.timeouts.implicit_wait = @timeout
wait = Selenium::WebDriver::Wait.new(timeout: @wait_time)

www.selenium.dev