Back To Normal

Subscribe To Our E-Mail Newsletter

Thursday, August 2, 2012

How to Clear cookies from internet Explorer by selenium webdriver?:


Couch ModePrint It


User can enable Ie capabilities then clear cookies 

DesiredCapabilities caps = DesiredCapabilities.internetExplorer(); caps.setCapability(CapabilityType.ForSeleniumServer.ENSURING_CLEAN_SESSION, true); WebDriver driver = new InternetExplorerDriver(caps);
driver.manage().deleteAllCookies()

If above one is not woking then U can go for Windows command level clearnace:

RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2

Java : Runtime.getRuntime().exec("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2");


Click Here For Smileys :D
:D
:)
:[
;)
:D
:O
(6)
(A)
:'(
:|
:o)
8)
(K)
(M)

3 comments:

Mario Galea said...

You're a KING!!!!!!

Puneesh Motwani said...

Hello!!

This works. But it works on my local machine. When I try to run this on remote machine(grid), it does not work. I get a following error:-

java.io.IOException: Cannot run program "C:\Windows\System32\rundll32.exe": error=2, No such file or directory

Please help.

Unknown said...

Desired capabilities are more useful in clearing the browser cache. This one is nice post and People willing to get the indepth knowledge in getting framework such as TestNG,jenkins,Maven and POM should get properly get selenium training in chennai

560 Free Online Courses

Top 200 universities launched 500 free online courses.  Please find the list here .