

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to automate gmail login process using selenium webdriver in java?
We can automate the Gmail login process using Selenium webdriver in Java. To perform this task, first we have to launch the Gmail login page and locate the email, password and other elements with the findElement method and then perform actions on them.
Let us have the look at the Gmail login page −
Code Implementation
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; public class GmailLogin{ public static void main(String[] args) { System.setProperty("webdriver.gecko.driver", "C:\Users\ghs6kor\Desktop\Java\geckodriver.exe"); WebDriver driver = new FirefoxDriver(); //implicit wait driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); //URL launch driver.get("https://accounts.google.com/signin"); //identify email WebElement l = driver .findElement(By.name("identifier")); l.sendKeys("abc@gmail.com"); WebElement b = driver .findElement(By.className("VfPpkd-LgbsSe")); b.click(); //identify password WebElement p = driver .findElement(By.name("password")); p.sendKeys("123456"); b.click(); //close browser driver.close(); } }
- Related Questions & Answers
- How to automate instagram login page using java in selenium?
- Gmail login fail using Selenium webdriver. Showing element not found for password.
- How to automate drag & drop functionality using Selenium WebDriver Java?
- How to automate Calendar using Selenium WebDriver for Testing?
- How to select checkboxes using selenium java webdriver?
- How to automate google Signup form in Selenium using Python?
- How to handle frame in Selenium WebDriver using java?
- How to use clickandwait in Selenium Webdriver using Java?
- How to scroll down using Selenium WebDriver with Java?
- How to perform mouseover function in Selenium WebDriver using Java?
- How to type in textbox using Selenium WebDriver with Java?
- How to get selected option using Selenium WebDriver with Java?
- How to handle authentication popup with Selenium WebDriver using Java?
- How to Verify Tooltip using Selenium WebDriver?
- How to upload files using Selenium Webdriver?
Advertisements