I am new in selenium. May be I might be incorrect in steps. Please correct me if I am wrong.
Objective behind this testcase is, if user closes the website where user logged in successfully, and then closes the browser. Now, when lunching a new browser for the same site, then login page should not display and redirect to inbox page.
Below is the sample code :
FirefoxDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get("https://mail.google.com/");
//Passing valid credentials
driver.findElement(By.xpath("//*[@id='Email']")).sendKeys("testuser@gmail.com");
driver.findElement(By.xpath("//*[@id='Passwd']")).sendKeys("password");
driver.findElement(By.xpath("//*[@id='signIn']")).click();
Thread.sleep(20000);
driver.close();
//Starting new browser
driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get("https://mail.google.com/");
Thread.sleep(20000);
driver.quit();