DEV Community

Manoj Naidu
Manoj Naidu

Posted on

2

Gmail Login by Automating Browser

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
Enter fullscreen mode Exit fullscreen mode

finally, cd to the script path in the terminal and type

ruby FILENAME.rb

Sit back and watch it in action!!

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay