How to clear cookies on already running browser instence in C#(or java)
53 views
Skip to first unread message
Kuldeep Singh
unread,
Sep 18, 2014, 4:26:59 AM9/18/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to seleniu...@googlegroups.com
I am doing below task-
1.I Created a simple firefox driver(named-Driver) using IWebDriver in c# 2.Then Run some test steps 3.Now I want to disable cookies after running some steps 4.I am trying this by using below line FirefoxProfile profile = new FirefoxProfileManager().GetProfile("default"); profile.SetPreference("network.cookie.cookieBehavior", 2); IWebDriver driver2 = new FirefoxDriver(profile); (I think it is wrong)
Porblem - How can I set above profile object(for disable cookies) on already running 'Driver' object(not on driver2) in middle of testcase execution.
Expected output and What I see instead?
Cookies should be disable for running browser instance, but instead of disable cookies for running 'Driver' object it is opening new browser instance.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to seleniu...@googlegroups.com
Try using - driver.manage().deleteAllCookies
Sudhansu Sekhar panda
unread,
Sep 22, 2014, 5:44:14 AM9/22/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to seleniu...@googlegroups.com
Hi Kuldeep,
As far my knowledge goes every time you run the script in FF it opens the default browser of the WebDriver not from the deafult profile of the browser...So for deleting cookies after navigating to any browser i am using the below code and it is working fine.