Unable to clear Browser cookies and Session Data with Selenium

Unable to clear Browser cookies and Session Data with Selenium

Questions : Unable to clear Browser cookies and Session Data with Selenium

271

I have been using Java Selenium WebDriver in4codes_android along with Appium to perform tests on Mobile in4codes_android environment be it Emulator(Genymotion) or in4codes_android Physical devices (Android). I am using in4codes_android chromedriver, which I am using to perform in4codes_android tests on Web App in Chrome browser. I am in4codes_android looping my cases for multiple sets of data in4codes_android but the application requires a full browser in4codes_android Cookie and all Session data to be deleted in4codes_android before each loop starts. I tried using in4codes_android driver.Manage().Deleteallcookies(), but it in4codes_android did not work out for me. I read in some in4codes_android threads to try creating a new session of the in4codes_android browser before each loop. So I tried in4codes_android driver.quit() but it ends the chromedriver in4codes_android session and ends the test. I also tried in4codes_android driver.close() but got the same results as in4codes_android driver.quit(). Can any one suggest a way to in4codes_android delete the browser cookies and session data in4codes_android in chrome browser??

My Appium version:1.3.4.1 Chromedriver in4codes_android version:2.3 Device/Emulator i am trying to in4codes_android test on : Nexus5/Samsung Note 3 in4codes_android Android:4.4.4/5.0

Total Answers 1
29

Answers 1 : of Unable to clear Browser cookies and Session Data with Selenium

You can try using the following to in4codes_java ensure a clear session. Note I never in4codes_java tested that myself. My understanding is in4codes_java that selenium by default create a new in4codes_java session unless you specified something in4codes_java different or load a profile.

DesiredCapabilities capabilities = DesiredCapabilities.chrome(); capabilities.setCapability(CapabilityType.ForSeleniumServer.ENSURING_CLEAN_SESSION, true); ChromeDriver driver = new ChromeDriver(capabilities); 

0