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
require 'rubygems' | |
require 'selenium-webdriver' | |
path = File.expand_path("test.html") | |
File.open(path, "w") { |io| io << DATA.read } | |
browser = Selenium::WebDriver.for :firefox # replace :firefox with the browser you're having trouble with | |
begin | |
browser.get "file://#{path}" |
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
require 'selenium-webdriver' | |
driver = Selenium::WebDriver.for :chrome | |
driver.extend Selenium::WebDriver::DriverExtensions::HasInputDevices | |
wait = Selenium::WebDriver::Wait.new | |
begin | |
driver.get "http://dev.sencha.com/deploy/touch/examples/kitchensink/" | |
wait.until { driver.all(:class => "x-list-item-body").find { |e| e.displayed? && e.text == "User Interface"} }.click |
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
require 'selenium-webdriver' | |
wait = Selenium::WebDriver::Wait.new | |
driver = Selenium::WebDriver.for :firefox | |
driver.get "http://www.google.no/?as_qdr=all" | |
driver.find_element(:name => "q").send_keys("selenium") | |
suggestions = nil |
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
require 'selenium-webdriver' | |
require 'rack' | |
require 'rack/handler/thin' | |
class IframeServer | |
def start | |
@pid = fork { Rack::Handler::Thin.run(self, :Port => 9292) } | |
poller = Selenium::WebDriver::SocketPoller.new("localhost", 9292, 30) | |
raise "could not start #{self.inspect}" unless poller.connected? |
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
require 'selenium-webdriver' | |
d = Selenium::WebDriver.for :firefox | |
begin | |
d.get "data:text/html,#{URI.escape DATA.read}" | |
d.find_elements(:tag_name => "option").last.click | |
sleep | |
ensure | |
d.quit | |
end |
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
e = @driver.find_element(:xpath, "//span[text()='IL-4']") | |
@driver.action.click_and_hold(e). | |
move_to(e, 0, 10). | |
release(e). | |
perform |
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
ReplSetConnection.new(['db1.app.com'], ['db2.app.com'], | |
:rs_name => "myapp") |
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
{:x=>"", :y=>""} | |
{:x=>"100", :y=>"2279"} | |
{:x=>"200", :y=>"2379"} | |
{:x=>"300", :y=>"2479"} |
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
require 'selenium/server' | |
server = Selenium::Server.new "/mnt/jobs/rake/selenium-server-standalone-2.2.0.jar", :background => true | |
server.start | |
# code | |
server.stop |
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
require 'selenium-webdriver' | |
d = Selenium::WebDriver.for :firefox | |
begin | |
d.get "data:text/html,#{URI.escape DATA.read}" | |
d.find_elements(:tag_name => "option").last.click | |
sleep | |
ensure | |
d.quit | |
end |
OlderNewer