Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with cookie.isSecure() method #795

Closed
2 tasks
sameerpatil2006 opened this issue Jun 23, 2017 · 4 comments
Closed
2 tasks

Issue with cookie.isSecure() method #795

sameerpatil2006 opened this issue Jun 23, 2017 · 4 comments
Assignees

Comments

@sameerpatil2006
Copy link

In order to help us efficiently investigate your issue, please provide the following information:

Platform and application details

  • Platform: Windows 10
  • Firefox: 47.0.2 , 53.0
  • Selenium: 3.4

Steps to reproduce

  • import gecko drivers
  • Get to any website with secure cookies (here I m using www.concursolutions.com)
  • Get cookies
    *Check if cookie is secure using isSecure() method (if the cookie is secure it should return true or else false)

In this case even though www.concursolutions.com has 1 secure cookie it returns false and if I use same using chrome driver I get correct results, it returns true.

  • Reproducable testcase:

import org.openqa.selenium.Cookie;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import java.util.Set;
/**

  • Created by patils33 on 6/22/2017.
    */
    public class SampleTest {
    public static void main(String[] args) throws Exception {
    // System. setProperty("webdriver.chrome.driver", "C:\Users\patils33\Desktop\chromedriver_win32\chromedriver.exe");
    System. setProperty("webdriver.gecko.driver","C:\Users\patils33\Desktop\geckodriver-v0.17.0-win64\geckodriver.exe");
    WebDriver driver = new FirefoxDriver();

      driver.get("https://www.concursolutions.com/");
     Set<Cookie> cookies = driver.manage().getCookies();
     for (Cookie c : cookies) {
             System.out.println("Cookies Name:" + c.getName()+" ::Is Secure : "+c.isSecure());
     }
    

    }
    }

  • A trace level log:

1498229966411 geckodriver INFO Listening on 127.0.0.1:45759
1498229967082 geckodriver::marionette INFO Starting browser C:\Program Files (x86)\Mozilla Firefox\firefox.exe with args ["-marionette"]
JavaScript warning: resource://cck2/CCK2.jsm, line 1077: unreachable code after return statement
JavaScript warning: resource://cck2/Preferences.jsm, line 556: mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create
1498229968082 Marionette INFO Listening on port 60880
Jun 23, 2017 10:59:32 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Cookies Name:brandingid ::Is Secure : false
Cookies Name:OTLang ::Is Secure : false
Cookies Name:OTSESSIONAABQRN ::Is Secure : false

@florentbr
Copy link

Save type of issue as #463.

Marionette is using a different name to hold the property nsICookie#isSecure between chrome://marionette/content/driver.js and chrome://marionette/content/listener.js.

@andreastt
Copy link
Contributor

Can be addressed as part of https://bugzilla.mozilla.org/show_bug.cgi?id=1372582.

@whimboo
Copy link
Collaborator

whimboo commented Jan 12, 2018

I tested with Firefox 57 and it works just fine:

1515758468135	webdriver::server	DEBUG	<- 200 OK {"value":[{"name":"OTSESSIONAABQRN","value":"9793B7AAG36C0G4263GA492G4D6CF52083AB","path":"/","domain":"www.concursolutions.com","expiry":9223372036854776000,"secure":true,"httpOnly":true},{"name":"OTLang","value":"en%2Dus","path":"/","domain":"www.concursolutions.com","expiry":9223372036854776000,"secure":false,"httpOnly":false},{"name":"brandingid","value":"11","path":"/","domain":"www.concursolutions.com","expiry":9223372036854776000,"secure":false,"httpOnly":false}]}

The cookie with the name OTSESSIONAABQRN is marked as secure, and as such the following test works:

    def test(self):
        self.driver.get("http://www.concursolutions.com/")
        cookies = self.driver.get_cookies()
        for cookie in cookies:
            print "*** name=%s secure=%s" % (cookie["name"], cookie["secure"])

The output is:

*** name=OTSESSIONAABQRN secure=True
*** name=OTLang secure=False
*** name=brandingid secure=False

Just to check... the WebDriver spec says the JSON key is "secure":
https://w3c.github.io/webdriver/webdriver-spec.html#cookies

So all is fine now. Most likely https://bugzilla.mozilla.org/show_bug.cgi?id=1371733 fixed it already for Firefox 56.

@lock
Copy link

lock bot commented Aug 16, 2019

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have run into an issue you think is related, please open a new issue.

@lock lock bot locked and limited conversation to collaborators Aug 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants