Last active
May 4, 2017 08:44
-
-
Save Sankame/105475ff842cd9bf6ad6 to your computer and use it in GitHub Desktop.
Selenium WebDriverを起動するサンプルプログラム
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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:4444/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