selenium-google-code-issue-archive icon indicating copy to clipboard operation
selenium-google-code-issue-archive copied to clipboard

Cookies no longer persisting between URL navigation in PhantomJS

Open lukeis opened this issue 8 years ago • 4 comments

Originally reported on Google Code with ID 8158

What steps will reproduce the problem?
1. Setup IWebDriver as PhantomJSDriver
2. Navigate() to URL
3. Set a cookie, _driver.Manage().Cookies.SetCookie(...)
4. Navigate to another URL on same domain, _driver.Navigate().GoToUrl(...)
5. Show all cookies, _driver.Manage().Cookies.AllCookies

What is the expected output? What do you see instead?
The cookie set in step 3 should be in the list of AllCookies, but it is not. The cookie
is lost between URL navigation.

Selenium version: 2.44
OS: Windows 8.0
Browser: PhantomJS
Browser version: 1.9.8

This is not an issue when using WebDriver 2.37. This works when using ChromeDriver,
so it seems it is a WebDriver-PhantomJS issue.

Reported by [email protected] on 2014-11-12 13:46:03

lukeis avatar Mar 04 '16 09:03 lukeis

Reported by barancev on 2014-11-12 14:22:00

  • Labels added: Browser-PhantomJS

lukeis avatar Mar 04 '16 09:03 lukeis

Can't reproduce in Java:

    WebDriver driver = new PhantomJSDriver();

    try {
      driver.get("http://docs.seleniumhq.org/download/");
      driver.manage().addCookie(new Cookie("test", "test"));
      driver.get("http://docs.seleniumhq.org/projects/");
      System.out.println(driver.manage().getCookies());

    } finally {
      driver.quit();
    }

gives this output:

[INFO  - 2015-04-03T08:33:52.920Z] GhostDriver - Main - running on port 4751
[INFO  - 2015-04-03T08:33:53.147Z] Session [28f98070-d9dc-11e4-9028-fdf2603444e1] -
page.settings - {"XSSAuditingEnabled":false,"javascriptCanCloseWindows":true,"javascriptCanOpenWindows":true,"javascriptEnabled":true,"loadImages":true,"localToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0
(Windows NT 6.1; WOW64) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34","webSecurityEnabled":true}
[INFO  - 2015-04-03T08:33:53.147Z] Session [28f98070-d9dc-11e4-9028-fdf2603444e1] -
page.customHeaders:  - {}
[INFO  - 2015-04-03T08:33:53.147Z] Session [28f98070-d9dc-11e4-9028-fdf2603444e1] -
Session.negotiatedCapabilities - {"browserName":"phantomjs","version":"1.9.8","driverName":"ghostdriver","driverVersion":"1.1.0","platform":"windows-7-32bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"}}
[INFO  - 2015-04-03T08:33:53.147Z] SessionManagerReqHand - _postNewSessionCommand -
New Session Created: 28f98070-d9dc-11e4-9028-fdf2603444e1
[test=test; path=/; domain=docs.seleniumhq.org, JSESSIONID=F5FNN0Zh4TDPImM5e1-k-Q;
path=/; domain=docs.seleniumhq.org]

Is it a .Net-specific issue?

Reported by barancev on 2015-04-03 08:35:14

lukeis avatar Mar 04 '16 09:03 lukeis

Yes, reproduced in .Net

Reported by barancev on 2015-04-03 10:08:02

  • Labels added: Lang-CSharp

lukeis avatar Mar 04 '16 09:03 lukeis

Reported by luke.semerau on 2015-09-17 17:47:30

  • Labels added: Restrict-AddIssueComment-Commit

lukeis avatar Mar 04 '16 09:03 lukeis