Last active
July 20, 2016 06:25
-
-
Save DylanLacey/094532b6a4a2bc37c87645277c0c7565 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
source "http://www.rubygems.org" | |
gem "selenium-webdriver" |
This file contains hidden or 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
## Have in a directory with Gemfile. | |
## Run `gem install bundler && bundle install` beforehand. | |
## Start a Marionette-enabled Selenium Server and change server_url to match (line 8). | |
## Then run this script with `bundle exec ruby test_script.rb`. | |
require "selenium/webdriver" | |
def server_url | |
"http://127.94.0.1:4444/wd/hub" | |
end | |
def caps | |
caps = Selenium::WebDriver::Remote::Capabilities.firefox marionette: true | |
end | |
driver = Selenium::WebDriver.for :remote, :url => server_url, :desired_capabilities => caps | |
driver.navigate.to "http://google.com" | |
driver.find_element :tag_name, "h1" | |
driver.execute_script "window.open()" | |
puts driver.window_handles | |
driver.quit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment