I want run one test script. The scenario is like that;
- Go to login page
- Login with valid credentials
- Close current single tab
- Go to the login page again
- Verify whether browser will go homepage instead of login page or not.
But i don't know how can i do that. Because if i use close or quit method, session id will be killed. even if i open new browser for another step, it will not be same with real scenario. Because as manually, if i try to go to login page after closing single open homepage without logging out, i can go to home page directly. I am not be able to automate it.
I used some Actions method to close and also open new tab. And i used these;
driver.findElement(By.cssSelector(“body”)).sendKeys(Keys.CONTROL+”t”);
driver.findElement(By.cssSelector(“body”)).sendKeys(Keys.CONTROL + 'w');
I am using Selenium+Java+Cucumber+Chrome+Mac