admin管理员组

文章数量:1312637

How can I delete cookies in WebDriverJS? I want to run some tests on a website that creates login cookies (and I have to clear cookies each time I want to run the tests).

I want to start a clean session each time I run the test. What can I do?

How can I delete cookies in WebDriverJS? I want to run some tests on a website that creates login cookies (and I have to clear cookies each time I want to run the tests).

I want to start a clean session each time I run the test. What can I do?

Share Improve this question edited Aug 8, 2014 at 11:10 Artjom B. 62k26 gold badges135 silver badges229 bronze badges asked Oct 15, 2013 at 11:23 cristifilipcristifilip 1432 silver badges11 bronze badges 4
  • Are you facing any problem in using deleteAllCookies() method? – HemChe Commented Oct 15, 2013 at 11:29
  • I tried to use driver.manage().deleteAllCookies(); but that's a Java method. I'm using WebdriverJS – cristifilip Commented Oct 15, 2013 at 11:54
  • As seen from the example given under EXAMPLE section in this link https://github./dmachi/webdriver-js , we can use session.deleteAllCookies(); – HemChe Commented Oct 15, 2013 at 12:12
  • in webdriverio it is client.deleteCookie(), it removes all cookies – ChristianB Commented Aug 21, 2014 at 7:48
Add a ment  | 

1 Answer 1

Reset to default 7

I can confirm that driver.manage().deleteAllCookies() works in WebDriverJS.

If you view the source and search for deleteAllCookies you'll see the function.

https://code.google./p/selenium/source/browse/javascript/webdriver/webdriver.js#1014

本文标签: javascriptDelete cookies in WebDriverJSStack Overflow