Gmail Login by Automating Browser
Manoj Naidu
Posted on August 18, 2018
Prerequisites
- Make sure you run latest version of firefox
- Make sure you have installed geckodriver (a firefox webdriver) in your ruby executable path
- Run
gem install watir
to install watir gem
It's show time!!
require 'watir'
browser = Watir::Browser.new(:firefox) # To launch the browser
browser.goto("https://www.gmail.com")
sleep 2
browser.text_field(class: "whsOnd zHQkBf").set "{ YOUR GMAIL ADDRESS HERE }"
sleep 2
browser.span(index: 4).click
sleep 2
browser.text_field(name: "password").set "{ YOUR GMAIL PASSWORD HERE }"
sleep 2
browser.send_keys :enter
finally, cd to the script path in the terminal and type
ruby FILENAME.rb
Sit back and watch it in action!!
💖 💪 🙅 🚩
Manoj Naidu
Posted on August 18, 2018
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.