Skip to content

Instantly share code, notes, and snippets.

@Sankame
Last active May 4, 2017 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sankame/dc5fb2d680b67acefbf3 to your computer and use it in GitHub Desktop.
Save Sankame/dc5fb2d680b67acefbf3 to your computer and use it in GitHub Desktop.
Selenium WebDriverを使ってブラウザ起動するプログラム
#!/usr/bin/ruby
require 'rubygems'
require 'selenium-webdriver'
#driver = Selenium::WebDriver.for :ie
caps = Selenium::WebDriver::Remote::Capabilities.internet_explorer(
:javascript_enabled => true)
driver = Selenium::WebDriver.for(:remote
, :url => "http://192.168.130.130:4445/wd/hub"
, :desired_capabilities => caps)
driver.get "http://www.yahoo.co.jp"
wait = Selenium::WebDriver::Wait.new(:timeout => 5) # seconds
begin
element = wait.until { driver.find_element(:id => "some-dynamic-element") }
ensure
driver.quit
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment