Send Automatic emails using Gmail through HTML view.



import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;

public class Gmail_login {

public static void main(String[] args) {
WebDriver driver=new FirefoxDriver();
driver.navigate().to("http://www.gmail.com");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {

e.printStackTrace();
}
driver.findElement(By.id("Email")).sendKeys(""); //Enter your email
try {
Thread.sleep(1000);
} catch (InterruptedException e) {

e.printStackTrace();
}
driver.findElement(By.id("next")).click();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {

e.printStackTrace();
}

try {
Thread.sleep(1000);
} catch (InterruptedException e) {

e.printStackTrace();
}
driver.findElement(By.id("Passwd")).sendKeys(""); //Enter Your Password
try {
Thread.sleep(1000);
} catch (InterruptedException e) {

e.printStackTrace();
}
driver.findElement(By.id("signIn")).click();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {

e.printStackTrace();
}

try {
Thread.sleep(1000);
} catch (InterruptedException e) {

e.printStackTrace();
}
driver.findElement(By.cssSelector("body > table:nth-child(16) > tbody > tr > td:nth-child(1) > table.m > tbody > tr:nth-child(1) > td > b > a")).click();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {

e.printStackTrace();
}
driver.findElement(By.cssSelector("#to")).sendKeys(""); //Enter Sender Email Address
try {
Thread.sleep(1000);
} catch (InterruptedException e) {

e.printStackTrace();
}
driver.findElement(By.name("subject")).sendKeys(""); //Enter Subject of mail
try {
Thread.sleep(1000);
} catch (InterruptedException e) {

e.printStackTrace();
}
driver.findElement(By.name("body")).sendKeys(""); //Enter email message
try {
Thread.sleep(1000);
} catch (InterruptedException e) {

e.printStackTrace();
}
driver.findElement(By.name("nvp_bu_send")).click(); //Click's on send button
try {
Thread.sleep(1000);
} catch (InterruptedException e) {

e.printStackTrace();
}

try {
Thread.sleep(3000);
} catch (InterruptedException e) {

e.printStackTrace();
}
driver.findElement(By.cssSelector("#gb_71")).click(); //Click on log-out button

}

}












Comments

  1. 8 Casino Review & Rating 2021 | CasinoGuide.com
    Casino Review, Games, Slots, Live Dealers, Banking & More. 익산 출장마사지 Check out our 삼척 출장안마 detailed 8 Casino review to see 광주 출장안마 what's 창원 출장마사지 great, and the 8 Casino bonus code 전주 출장안마 is  Rating: 2.2 · ‎Review by Dr

    ReplyDelete

Post a Comment

Popular posts from this blog

Book ticket online through IRCTC using Selenium Webdriver.

How to create a New Gmail Account using Selenium Web Driver.

SQL Injection.