Configurations:
OS : Ubuntu
Java version : 8
Selenium : 3.8.0
ChromeDriver : 2.33
Chrome version : 60
I'm automating an application where i have to login in a system using Social media
After entering mobile number it ask for password and there social media icon. If i click lets say google plus, it opens google plus login window then I have to provide credential then the window get closed automatically and user gets login. As shown here
My issue is, after logout from my application if i again try to login using google plus then it perform automatic login (second time it won't ask for google plus credentials as google plus session cookies are there)
So in my script I'm trying to delete all cookies after first test but it is not working code line I've tried :
driver.manage().deleteAllCookies();
For reference complete test look like :
@Test
public void newUserRegistration_GooglePlus_ForAlreadyExistEmail() throws IOException, InterruptedException, JSONException
{
LogoutAnalyzer.checkLogout();
loginpage.sendUsername(excel.getCellData(6, 18, 1));
CommonMethods.waitUntilLoaderGetInvisible(driver);
TakeScreenshot.passedScreenShot("Username");
LogWriter.logger.info("Mobile number has entered");
loginpage.clickSubmitButton();
CommonMethods.waitUntilLoaderGetInvisible(driver);
LogWriter.logger.info("Submit button clicked");
if(loginpage.otpTextbox.size()>0)
{
String OTP = otpreader.getOTP(excel.getCellData(6, 18, 1));
LogWriter.logger.info("Got the OTP via API call OTP is "+OTP);
loginpage.enterOTP(OTP);
TakeScreenshot.passedScreenShot("OTP_Entered");
LogWriter.logger.info("OTP Entered");
loginpage.clickConfirmCodeButton();
CommonMethods.waitUntilLoaderGetInvisible(driver);
LogWriter.logger.info("Submit button clicked");
TakeScreenshot.passedScreenShot("Profile_Info");
loginpage.clickGooglePlusIcon();
Thread.sleep(5000);
LogWriter.logger.info("Switch to Google Plus window");
CommonMethods.switchWindow(driver);
CommonMethods.waitForElementVisibility(driver, new RCONGooglePlusPage(driver).usernameField);
TakeScreenshot.passedScreenShot("Google Window");
sm_helper.googlePlusLogin(excel.getCellData(6, 18, 2), excel.getCellData(6, 18, 3));
CommonMethods.switchToParentWindow(driver);
LogWriter.logger.info("Switched back to RContacts window");
CommonMethods.waitUntilLoaderGetInvisible(driver);
Assert.assertEquals(loginpage.getValidationMessage(), PropertyFileReader.getProperty("emailAlreadyExistMessage"));
LogWriter.logger.info(PropertyFileReader.getProperty("emailAlreadyExistMessage"));
}
else
{
TakeScreenshot.passedScreenShot("Already_registered_User");
LogWriter.logger.info("This user is already a registered user");
}
driver.manage().deleteAllCookies();
LogWriter.logger.info("all cookies deleted");
}