Last active
April 24, 2019 16:14
-
-
Save shoesCodeFor/5512803d4f859fd56a0b55fb44d4f185 to your computer and use it in GitHub Desktop.
Basic Chrome/Selenium login with Ruby
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
require "selenium-webdriver" | |
driver = Selenium::WebDriver.for :chrome | |
wait = Selenium::WebDriver::Wait.new(:timeout => 18) | |
driver.navigate.to "https://someloginsite.web" | |
sleep 2 | |
element = driver.find_element(:class, "username") | |
element.send_keys "[email protected]" | |
pwd = driver.find_element(:class, "password") | |
pwd.send_keys "MyPasswords" | |
submit_btn = $driver.find_element(name: "submit") | |
submit_btn.click | |
sleep 3 | |
puts $driver.title |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment