import java.util.List;
import java.util.Scanner;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class InboxCount {
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
System.out.println("enter ur gmail id: ");
String id = kb.nextLine();
System.out.println("enter ur gmail pass: ");
String password = kb.nextLine();
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS);
driver.get("https://accounts.google.com/ServiceLogin?service=mail&passive=true&rm=false&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&ss=1&scc=1<mpl=default<mplcache=2&hl=en&emr=1&elo=1");
driver.findElement(By.id("Email")).sendKeys(id);
driver.findElement(By.xpath("//input[@id='Passwd']")).sendKeys(password);
driver.findElement(By.xpath("//input[@type='checkbox']")).click();
driver.findElement(By.name("signIn")).click();
String inbox = driver.findElement(By.xpath("//a[@href='https://mail.google.com/mail/u/0/#inbox']")).getText();
System.out.println(inbox);
//sign out
driver.findElement(By.xpath("//span[@class='gb_V gbii']")).click();
driver.findElement(By.linkText("Sign out")).click();
driver.close();
}
}
Hi,
ReplyDeletePlease give the code to count the number of unread emails present inside the inbox
Please find the code here for get the unread mail.
ReplyDeletehttp://selenium-makeiteasy.blogspot.in/2014/05/how-to-login-get-number-of-mails-in.html
Hi Sanjay Kumar Ji,You are doing a Good Job of helping budding Selenium Testers(in Automation) like US.Please continue with your great work and Please provide as many Realtime Examples on concepts as Possible.ALL THE BEST.MAY GOD BLESS YOU.
ReplyDeleteyour Blog is useful for those who want to learn testing
ReplyDeleteplease provide information about testlink management tool how to install
ReplyDeleteHi Sanjay! i m stuck to delete the marked mail from gmail.com while searching by any word so could you provide the code for the same...
ReplyDeletethanks