mozilla / geckodriver

WebDriver for Firefox
https://firefox-source-docs.mozilla.org/testing/geckodriver/
Mozilla Public License 2.0
7.12k stars 1.52k forks source link

Cookies do not return expiration dates #463

Closed minusnine closed 7 years ago

minusnine commented 7 years ago

I'm working on improving Selenium3+Firefox support for a Go-based WebDriver implementation:

https://github.com/tebeka/selenium/tree/topic/geckodriver

There are a number of issues that I've found that appear to be a regression from Selenium 2's interaction with older versions of Firefox.

This one is that cookies returned from either the "Get All Cookies" or "Get Named Cookies" do not include the expiration date in the response. A full transcript is below.

In summary, a cookie added with:

2017/02/10 16:39:44 -> POST http://127.0.0.1:57328/wd/hub/session/9ab73cfa-134b-40af-b30e-043d4b767188/cookie
{"cookie":{"name":"the nameless cookie","value":"I have nothing","path":"","domain":"","secure":false,"expiry":4094967295}}
16:39:44.982 INFO - Executing: [add cookie: the nameless cookie=I have nothing; expires=Tue, 06 Oct 2099 10:54:55 UTC; path=/; domain=])
16:39:44.997 INFO - Done: [add cookie: the nameless cookie=I have nothing; expires=Tue, 06 Oct 2099 10:54:55 UTC; path=/; domain=]
2017/02/10 16:39:44 <- 200 OK [[application/json; charset=utf-8]]
{
    "state": "success",
    "sessionId": "9ab73cfa-134b-40af-b30e-043d4b767188",
    "hCode": 350981049,
    "value": null,
    "class": "org.openqa.selenium.remote.Response",
    "status": 0
}

does not have the expiry date in the response to "Get Named Cookie" (and "Get All Cookies", but that is not shown here):

2017/02/10 16:39:44 -> GET http://127.0.0.1:57328/wd/hub/session/9ab73cfa-134b-40af-b30e-043d4b767188/cookie/the nameless cookie

16:39:45.006 INFO - Executing: [get cookie named the nameless cookie])
16:39:45.021 INFO - Done: [get cookie named the nameless cookie]
2017/02/10 16:39:45 <- 200 OK [[application/json; charset=utf-8]]
{
    "state": "success",
    "sessionId": "9ab73cfa-134b-40af-b30e-043d4b767188",
    "hCode": 1993366015,
    "value": {
        "path": "/",
        "domain": "127.0.0.1",
        "name": "the nameless cookie",
        "httpOnly": false,
        "hCode": -1672802895,
        "secure": false,
        "value": "I have nothing",
        "class": "org.openqa.selenium.Cookie"
    },
    "class": "org.openqa.selenium.remote.Response",
    "status": 0
}

Firefox Version

Mozilla Firefox 54.0a1 (the latest nightly build)

Platform

Linux

Steps to reproduce -

The following assumes a working Go installation on Linux.

$ go get -u github.com/tebeka/selenium
$ cd ${GOPATH?}/src/github.com/tebeka/selenium
$ git checkout origin/topic/geckodriver 
$ cd vendor
# The following downloads Firefox, Geckodriver, and Selenium, among others.
$ go run init.go
$ cd ..
$ go test  --test.run=TestFirefoxSelenium3/AddCookie --firefox_binary vendor/firefox/firefox  --test.v

The above test will produce the output copied below.

Minimal HTML file

The minimal HTML file is a an empty page, since this is a cookie-related issue.

Log

16:15:34.381 INFO - Selenium build info: version: '3.0.1', revision: '1969d75'
16:15:34.384 INFO - Launching a standalone Selenium Server
2017-02-10 16:15:34.502:INFO::main: Logging initialized @2121ms
16:15:34.689 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
 registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platf
orm LINUX
16:15:34.689 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:
 registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform LINUX
16:15:34.689 INFO - Driver class not found: com.opera.core.systems.OperaDriver
16:15:34.690 INFO - Driver provider com.opera.core.systems.OperaDriver registration is skipped:
Unable to create new instances on this machine.
16:15:34.690 INFO - Driver class not found: com.opera.core.systems.OperaDriver
16:15:34.690 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
16:15:34.691 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped:
 registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform LINUX
2017-02-10 16:15:34.911:INFO:osjs.Server:main: jetty-9.2.15.v20160210
2017-02-10 16:15:34.978:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@6d00a15d{/,null,AVAILABLE}
2017-02-10 16:15:35.080:INFO:osjs.ServerConnector:main: Started ServerConnector@28d8beaa{HTTP/1.1}{0.0.0.0:48844}
2017-02-10 16:15:35.081:INFO:osjs.Server:main: Started @2700ms
16:15:35.081 INFO - Selenium Server is up and running
...
2017/02/10 16:18:01 -> POST http://127.0.0.1:55534/wd/hub/session
{"desiredCapabilities":{"browserName":"firefox","mox:firefoxOptions":{"binary":"vendor/firefox/firefox","log":{"level":"trace"}}}}
16:18:01.162 INFO - Executing: [new session: Capabilities [{mox:firefoxOptions={log={level=trace}, binary=vendor/firefox/firefox}, browserName=firefox}]])
16:18:01.188 INFO - Creating a new session for Capabilities [{mox:firefoxOptions={log={level=trace}, binary=vendor/firefox/firefox}, browserName=firefox}]
1486743481552   geckodriver     INFO    Listening on 127.0.0.1:27417
16:18:01.614 INFO - Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
1486743481663   mozprofile::profile     INFO    Using profile path /tmp/rust_mozprofile.65blUMYcEf1d
1486743481664   geckodriver::marionette INFO    Starting browser /usr/bin/firefox
1486743481669   geckodriver::marionette INFO    Connecting to Marionette on localhost:40105

(firefox:16547): GLib-GObject-CRITICAL **: g_object_ref: assertion 'object->ref_count > 0' failed

(firefox:16547): GLib-GObject-CRITICAL **: g_object_unref: assertion 'object->ref_count > 0' failed

(firefox:16547): GLib-GObject-CRITICAL **: g_object_ref: assertion 'object->ref_count > 0' failed

(firefox:16547): GLib-GObject-CRITICAL **: g_object_unref: assertion 'object->ref_count > 0' failed
1486743481972   addons.manager  DEBUG   Application has been upgraded
1486743481998   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/addons/XPIProvider.jsm: ["XPIProvider"]
1486743482002   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/LightweightThemeManager.jsm: ["LightweightThemeManager"]
1486743482010   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/addons/GMPProvider.jsm
1486743482015   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/addons/PluginProvider.jsm
1486743482018   addons.manager  DEBUG   Starting provider: XPIProvider
1486743482019   addons.xpi      DEBUG   startup
1486743482021   addons.xpi      INFO    SystemAddonInstallLocation directory is missing
1486743482024   addons.xpi      INFO    Mapping firefox@getpocket.com to /usr/lib/firefox/browser/features/firefox@getpocket.com.xpi
1486743482025   addons.xpi      INFO    Mapping webcompat@mozilla.org to /usr/lib/firefox/browser/features/webcompat@mozilla.org.xpi
1486743482027   addons.xpi      INFO    Mapping e10srollout@mozilla.org to /usr/lib/firefox/browser/features/e10srollout@mozilla.org.xpi
1486743482029   addons.xpi      INFO    Mapping aushelper@mozilla.org to /usr/lib/firefox/browser/features/aushelper@mozilla.org.xpi
1486743482030   addons.xpi      INFO    Mapping {972ce4c6-7e08-4474-a285-3208198ce6fd} to /usr/lib/firefox/browser/extensions/{972ce4c6-7e08-4474-a285-3208198c
e6fd}.xpi
1486743482033   addons.xpi      DEBUG   checkForChanges
1486743482035   addons.xpi      DEBUG   Loaded add-on state from prefs: {}
1486743482037   addons.xpi      DEBUG   New add-on firefox@getpocket.com in app-system-defaults
1486743482040   addons.xpi      DEBUG   getModTime: Recursive scan of firefox@getpocket.com
1486743482042   addons.xpi      DEBUG   New add-on webcompat@mozilla.org in app-system-defaults
1486743482043   addons.xpi      DEBUG   getModTime: Recursive scan of webcompat@mozilla.org
1486743482045   addons.xpi      DEBUG   New add-on e10srollout@mozilla.org in app-system-defaults
1486743482047   addons.xpi      DEBUG   getModTime: Recursive scan of e10srollout@mozilla.org
1486743482049   addons.xpi      DEBUG   New add-on aushelper@mozilla.org in app-system-defaults
1486743482050   addons.xpi      DEBUG   getModTime: Recursive scan of aushelper@mozilla.org
1486743482052   addons.xpi      DEBUG   New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} in app-global
1486743482054   addons.xpi      DEBUG   getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
1486743482178   addons.xpi      DEBUG   Loading bootstrap scope from /usr/lib/firefox/browser/features/aushelper@mozilla.org.xpi                    [138/12369]
1486743482182   addons.xpi      DEBUG   Calling bootstrap method install on aushelper@mozilla.org version 1.0
1486743482184   addons.xpi-utils        DEBUG   Make addon app-system-defaults:aushelper@mozilla.org visible
1486743482184   DeferredSave.extensions.json    DEBUG   Save changes
1486743482185   addons.xpi-utils        DEBUG   Make addon app-global:{972ce4c6-7e08-4474-a285-3208198ce6fd} visible
1486743482185   DeferredSave.extensions.json    DEBUG   Save changes
1486743482186   addons.xpi      DEBUG   Updating XPIState for {"id":"firefox@getpocket.com","syncGUID":"{c3d1b83a-025f-4a81-9557-6a8961583101}","location":"app
-system-defaults","version":"1.0.5","type":"extension","internalName":null,"updateURL":null,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":nu
ll,"icons":{},"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Pocket","description":"When you find something you want to view later, put it in Pocket.
","creator":null,"homepageURL":null},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"/usr/lib/firefox/browser/features/fire
fox@getpocket.com.xpi","installDate":1485321207000,"updateDate":1485321207000,"applyBackgroundUpdates":1,"bootstrap":true,"skinnable":false,"size":921009,"sour
ceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetAppl
ications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"51.0","maxVersion":"51.*"}],"targetPlatforms":[],"multiprocessCompatible":true,"seen":t
rue,"dependencies":[],"hasEmbeddedWebExtension":false,"mpcOptedOut":false}
1486743482189   addons.xpi      DEBUG   getModTime: Recursive scan of firefox@getpocket.com
1486743482190   addons.xpi      DEBUG   Updating XPIState for {"id":"webcompat@mozilla.org","syncGUID":"{9b4e2c5a-4e3d-460a-bc68-3201b845afcf}","location":"app
-system-defaults","version":"1.0","type":"extension","internalName":null,"updateURL":null,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null
,"icons":{},"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Web Compat","description":"Urgent post-release fixes for web compatibility.","creator":nul
l,"homepageURL":null},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"/usr/lib/firefox/browser/features/webcompat@mozilla.o
rg.xpi","installDate":1485321207000,"updateDate":1485321207000,"applyBackgroundUpdates":1,"bootstrap":true,"skinnable":false,"size":1568,"sourceURI":null,"rele
aseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":
"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"51.0","maxVersion":"51.*"}],"targetPlatforms":[],"multiprocessCompatible":true,"seen":true,"dependencies
":[],"hasEmbeddedWebExtension":false,"mpcOptedOut":false}
1486743482190   addons.xpi      DEBUG   getModTime: Recursive scan of webcompat@mozilla.org
1486743482191   addons.xpi      DEBUG   Updating XPIState for {"id":"e10srollout@mozilla.org","syncGUID":"{a5236925-12d1-4a83-9a85-cbcaad787ef1}","location":"a
pp-system-defaults","version":"1.7","type":"extension","internalName":null,"updateURL":null,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":nu
ll,"icons":{},"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Multi-process staged rollout","description":"Staged rollout of Firefox multi-process fea
ture.","creator":null,"homepageURL":null},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"/usr/lib/firefox/browser/features
/e10srollout@mozilla.org.xpi","installDate":1485321207000,"updateDate":1485321207000,"applyBackgroundUpdates":1,"bootstrap":true,"skinnable":false,"size":6995,
"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targe
tApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"51.0","maxVersion":"51.*"}],"targetPlatforms":[],"multiprocessCompatible":true,"se
en":true,"dependencies":[],"hasEmbeddedWebExtension":false,"mpcOptedOut":false}
1486743482191   addons.xpi      DEBUG   getModTime: Recursive scan of e10srollout@mozilla.org
1486743482192   addons.xpi      DEBUG   Updating XPIState for {"id":"aushelper@mozilla.org","syncGUID":"{aa6cd719-1b2d-4f6c-a073-d015c58daf3e}","location":"app
-system-defaults","version":"1.0","type":"extension","internalName":null,"updateURL":null,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null
,"icons":{},"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Application Update Service Helper","description":"Sets value(s) in the update url based on
 custom checks.","creator":null,"homepageURL":null},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"/usr/lib/firefox/browse
r/features/aushelper@mozilla.org.xpi","installDate":1485321207000,"updateDate":1485321207000,"applyBackgroundUpdates":1,"bootstrap":true,"skinnable":false,"siz
e":5973,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[
],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"51.0","maxVersion":"51.*"}],"targetPlatforms":[],"multiprocessCompatible":
true,"seen":true,"dependencies":[],"hasEmbeddedWebExtension":false,"mpcOptedOut":false}
1486743482193   addons.xpi      DEBUG   getModTime: Recursive scan of aushelper@mozilla.org
1486743482194   addons.xpi      DEBUG   Updating XPIState for {"id":"{972ce4c6-7e08-4474-a285-3208198ce6fd}","syncGUID":"{c2b87258-6b74-4723-8df5-26cccc1ed1e9}
","location":"app-global","version":"51.0","type":"theme","internalName":"classic/1.0","updateURL":null,"updateKey":null,"optionsURL":null,"optionsType":null,"
aboutURL":null,"icons":{"32":"icon.png","48":"icon.png"},"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Default","description":"The default theme.","
creator":"Mozilla","homepageURL":null,"contributors":["Mozilla Contributors"]},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descripto
r":"/usr/lib/firefox/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","installDate":1485321207000,"updateDate":1485321207000,"applyBackgroundUpda
tes":1,"skinnable":true,"size":4926,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictComp
atibility":true,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"51.0","maxVersion":"51.0"}],"targetPlatforms":[
],"seen":true,"dependencies":[],"hasEmbeddedWebExtension":false}
1486743482197   addons.xpi      DEBUG   getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
1486743482199   DeferredSave.extensions.json    DEBUG   Save changes
1486743482201   addons.xpi      DEBUG   Updating database with changes to installed add-ons
1486743482201   addons.xpi-utils        DEBUG   Updating add-on states
1486743482203   addons.xpi-utils        DEBUG   Writing add-ons list
1486743482206   addons.xpi      DEBUG   Registering manifest for /usr/lib/firefox/browser/features/aushelper@mozilla.org.xpi
1486743482206   addons.xpi      DEBUG   Calling bootstrap method startup on aushelper@mozilla.org version 1.0
1486743482208   addons.xpi      DEBUG   Registering manifest for /usr/lib/firefox/browser/features/e10srollout@mozilla.org.xpi
1486743482209   addons.xpi      DEBUG   Calling bootstrap method startup on e10srollout@mozilla.org version 1.7
1486743482210   addons.xpi      DEBUG   Registering manifest for /usr/lib/firefox/browser/features/firefox@getpocket.com.xpi
1486743482211   addons.xpi      DEBUG   Calling bootstrap method startup on firefox@getpocket.com version 1.0.5
1486743482214   addons.xpi      DEBUG   Registering manifest for /usr/lib/firefox/browser/features/webcompat@mozilla.org.xpi
1486743482215   addons.xpi      DEBUG   Calling bootstrap method startup on webcompat@mozilla.org version 1.0
1486743482219   addons.manager  DEBUG   Registering shutdown blocker for XPIProvider
1486743482220   addons.manager  DEBUG   Provider finished startup: XPIProvider
1486743482220   addons.manager  DEBUG   Starting provider: LightweightThemeManager
1486743482220   addons.manager  DEBUG   Registering shutdown blocker for LightweightThemeManager
1486743482220   addons.manager  DEBUG   Provider finished startup: LightweightThemeManager
1486743482221   addons.manager  DEBUG   Starting provider: GMPProvider
1486743482233   addons.manager  DEBUG   Registering shutdown blocker for GMPProvider
1486743482233   addons.manager  DEBUG   Provider finished startup: GMPProvider
1486743482233   addons.manager  DEBUG   Starting provider: PluginProvider
1486743482234   addons.manager  DEBUG   Registering shutdown blocker for PluginProvider
1486743482234   addons.manager  DEBUG   Provider finished startup: PluginProvider
1486743482235   addons.manager  DEBUG   Completed startup sequence
1486743482520   Marionette      INFO    Listening on port 40105
1486743482770   addons.manager  DEBUG   Starting provider: <unnamed-provider>
1486743482770   addons.manager  DEBUG   Registering shutdown blocker for <unnamed-provider>
1486743482773   addons.manager  DEBUG   Provider finished startup: <unnamed-provider>
1486743482795   addons.manager  DEBUG   Starting provider: PreviousExperimentProvider
1486743482797   addons.manager  DEBUG   Registering shutdown blocker for PreviousExperimentProvider
1486743482804   addons.manager  DEBUG   Provider finished startup: PreviousExperimentProvider
1486743482811   DeferredSave.extensions.json    DEBUG   Starting write
1486743483032   DeferredSave.extensions.json    DEBUG   Write succeeded
1486743483035   addons.xpi-utils        DEBUG   XPI Database saved, setting schema version preference to 19
16:18:04.535 INFO - Detected dialect: W3C
16:18:04.599 INFO - Done: [new session: Capabilities [{mox:firefoxOptions={log={level=trace}, binary=vendor/firefox/firefox}, firefoxOptions=org.openqa.seleniu
m.firefox.FirefoxOptions@334e114, browserName=firefox, moz:firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions@334e114}]]
2017/02/10 16:18:04 <- 200 OK [[application/json; charset=utf-8]]
{
    "state": null,
    "sessionId": "6a2647aa-6aae-4e88-8981-6fe49895676b",
    "hCode": 325122435,
    "value": {
        "mox:firefoxOptions": {
            "log": {
                "level": "trace"
            },
            "binary": "vendor/firefox/firefox"
        },
        "rotatable": false,
        "raisesAccessibilityExceptions": false,
        "firefoxOptions": {
            "args": [],
            "profile": "UEsDBBQACAgIAECCSkoAAAAAAAAAAAAAAAAHAAAAdXNlci5qc51WTW/bMAy971cMOW3AKqTretlOXdcBA4Z1aFDsKMgSbauRJU0fcfPvR/mjSRNHbndKbJMS+fj4yOjBUeugfLc
onGnxiXhWQvdf6oo0TLXMAQHNCgVi8eFtyZSH91/exJ2nYAFtrHEhudTAVKj7Z4JGG8ln/DWE1rg1qUOwxNbS19uz9Nky788U6CrU6Pjx8vK52xiwAybwR0AAHkB8l86HK4yFK0C34OJhuKbBvB4pr51pgHrupA
3URU2DbJLLxXL6osAKTxAOfauvlfEwnc1oLUyrlWEC79KsSsDWpv1Tg14hWgmpaXeLQdng02W0MYKpGexhE4xRnoBzxnGjvVH7cB+n72WljUbUGmgKcKvu0edz8eC9RKtgkAsOfETcSgyUcsd8nfdVUq+JsaApP
AZwmqlUzFczqExlvYt6+rIWCuHkBp8Z54DljBoz90gHysEFP4nEU6Wkt4ptQdycL1e/DDInlfbTtDG+Erf6j9RYX3++JBIvMvd3P9FjwQoTw+dCMb1eHHOuT4gypeiDRzBSnLKH/ji2RysRbrQlbS0DKOkDHvA3
SneKCYkGaxnI0E0j6zC5xIUsAIphYbAB8lTzibfRkhq7xuLZtAXFUwdFl0q6OEg5VVt3rCHRYoGBaIS23N6jyat1JNrUSjfZ8IBHJ8MWmaIA/xEfnOSBGicrqak1SvJtnqoaWmw7MuSTqeazQPuTSXq5ikUju1b
53b286sj4Mt2cPCab8VN3DoVJRUHLE+q160NMs+34e9yIpizRDs6YtZ4g+0xLiy0VULKowrScjLBzbwf+TEd7zIcs20Y6I/dRqYLbkl4ZO/uPc7bZo0dEbu5/XpELwnZFOk7vgW1YPyGyonpYirFH8jw6jtvBQz
fEspf0NE3H5/PcQ5zFYL71SrDiSIIkOufLUxran0o1C/hIYQM6zAyIvdF4ixSbjadQhq87UXtRpTwwx+uBN3NjtyE9u4mIjc1WDVn+Ii4+I4xBhJwU04p6JEKH6nMxvfr0an02th/SKMQZyAfbE9Iy7Djzy83e5
PTdXN9NTpSg2Gl1FrlErekg9nrH9KOu24F+6Ot+TTm5nQ0zi3ZqJRBGXdGk/zMkqQHHJa+Br7/1gvW1//L6cUaYEDJFzGYmweTS/L/LsjJVlV4OW1xW+/d6qcv4GrUR27WQKrFPy6oO6sS023Mdb/wfaaNjI5AG
98KOiIu0Szo4wGi3yqTVE4mNC+TMLrPre1X6aPsVYLdl/ANQSwcIy87bUaYDAAC2DAAAUEsBAhQAFAAICAgAQIJKSsvO21GmAwAAtgwAAAcAAAAAAAAAAAAAAAAAAAAAAHVzZXIuanNQSwUGAAAAAAEAAQA1AAA
A2wMAAAAA"
        },
        "appBuildId": "20170125042157",
        "version": "51.0",
        "platform": "LINUX",
        "proxy": {},
        "command_id": 1,
        "specificationLevel": 0,
        "acceptSslCerts": false,
        "processId": 16547,
        "webdriver.remote.sessionid": "6a2647aa-6aae-4e88-8981-6fe49895676b",
        "browserVersion": "51.0",
        "platformVersion": "3.16.0-4-amd64",
        "XULappId": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
        "browserName": "firefox",
        "takesScreenshot": true,
        "takesElementScreenshot": true,
        "javascriptEnabled": true,
        "platformName": "linux",
        "cssSelectorsEnabled": true
    },
    "class": "org.openqa.selenium.remote.Response",
    "status": 0
}
2017/02/10 16:18:04 -> POST http://127.0.0.1:55534/wd/hub/session/6a2647aa-6aae-4e88-8981-6fe49895676b/url
{"url":"http://127.0.0.1:44254"}
16:18:04.622 INFO - Executing: [get: http://127.0.0.1:44254])
16:18:04.899 INFO - Done: [get: http://127.0.0.1:44254]
2017/02/10 16:18:04 <- 200 OK [[application/json; charset=utf-8]]
{
    "state": "success",
    "sessionId": "6a2647aa-6aae-4e88-8981-6fe49895676b",
    "hCode": 1398068506,
    "value": null,
    "class": "org.openqa.selenium.remote.Response",
    "status": 0
}
2017/02/10 16:18:04 -> POST http://127.0.0.1:55534/wd/hub/session/6a2647aa-6aae-4e88-8981-6fe49895676b/cookie
{"cookie":{"name":"the nameless cookie","value":"I have nothing","path":"","domain":"","secure":false,"expiry":4094967295}}
16:18:04.919 INFO - Executing: [add cookie: the nameless cookie=I have nothing; expires=Tue, 06 Oct 2099 10:54:55 UTC; path=/; domain=])
16:18:04.966 INFO - Done: [add cookie: the nameless cookie=I have nothing; expires=Tue, 06 Oct 2099 10:54:55 UTC; path=/; domain=]
2017/02/10 16:18:04 <- 200 OK [[application/json; charset=utf-8]]
{
    "state": "success",
    "sessionId": "6a2647aa-6aae-4e88-8981-6fe49895676b",
    "hCode": 1393298629,
    "value": null,
    "class": "org.openqa.selenium.remote.Response",
    "status": 0
}
2017/02/10 16:18:04 -> GET http://127.0.0.1:55534/wd/hub/session/6a2647aa-6aae-4e88-8981-6fe49895676b/cookie/the nameless cookie

16:18:04.980 INFO - Executing: [get cookie named the nameless cookie])
16:18:05.028 INFO - Done: [get cookie named the nameless cookie]
2017/02/10 16:18:05 <- 200 OK [[application/json; charset=utf-8]]
{
    "state": "success",
    "sessionId": "6a2647aa-6aae-4e88-8981-6fe49895676b",
    "hCode": 1096388905,
    "value": {
        "path": "/",
        "domain": "127.0.0.1",
        "name": "the nameless cookie",
        "httpOnly": false,
        "secure": false,
        "hCode": -1672802895,
        "value": "I have nothing",
        "class": "org.openqa.selenium.Cookie"
    },
    "class": "org.openqa.selenium.remote.Response",
    "status": 0
}
{
    "state": "success",
    "sessionId": "6a2647aa-6aae-4e88-8981-6fe49895676b",
    "hCode": 1096388905,
    "value": {
        "path": "/",
        "domain": "127.0.0.1",
        "name": "the nameless cookie",
        "httpOnly": false,
        "secure": false,
        "hCode": -1672802895,
        "value": "I have nothing",
        "class": "org.openqa.selenium.Cookie"
    },
    "class": "org.openqa.selenium.remote.Response",
    "status": 0
}2017/02/10 16:18:05 -> DELETE http://127.0.0.1:55534/wd/hub/session/6a2647aa-6aae-4e88-8981-6fe49895676b

16:18:05.033 INFO - Executing: [delete session: 6a2647aa-6aae-4e88-8981-6fe49895676b])
1486743485051   addons.xpi      DEBUG   Calling bootstrap method shutdown on webcompat@mozilla.org version 1.0
1486743485052   addons.xpi      DEBUG   Calling bootstrap method shutdown on firefox@getpocket.com version 1.0.5
1486743485053   addons.xpi      DEBUG   Calling bootstrap method shutdown on e10srollout@mozilla.org version 1.7
1486743485053   addons.xpi      DEBUG   Calling bootstrap method shutdown on aushelper@mozilla.org version 1.0
16:18:05.149 INFO - Done: [delete session: 6a2647aa-6aae-4e88-8981-6fe49895676b]
2017/02/10 16:18:05 <- 200 OK [[application/json; charset=utf-8]]
{
    "state": "success",
    "sessionId": "6a2647aa-6aae-4e88-8981-6fe49895676b",
    "hCode": 958156537,
    "value": null,
    "class": "org.openqa.selenium.remote.Response",
    "status": 0
}
florentbr commented 7 years ago

It's a bug in marionette. Here's a fix:

--- testing/marionette/driver.js    2017-06-07 18:09:34.316370300 +0100
+++ testing/marionette/driver.js    2017-06-07 18:58:49.413061100 +0100
@@ -3204,7 +3204,7 @@
               "path": cookie.path,
               "host": cookie.host,
               "secure": cookie.isSecure,
-              "expiry": cookie.expires,
+              "expiry": cookie.expiry,
               "httpOnly": cookie.isHttpOnly,
               "originAttributes": cookie.originAttributes
             });
--- testing/marionette/listener.js  2017-06-07 18:09:34.345907100 +0100
+++ testing/marionette/listener.js  2017-06-07 22:25:57.650249200 +0100
@@ -1659,14 +1659,17 @@
   let rv = [];

   for (let cookie of cookies) {
-    let expires = cookie.expires;
-    // session cookie, don't return an expiry
-    if (expires == 0) {
-      expires = null;
+    let expiry = cookie.expiry;
+
+    // session cookie, don't return an expiry.
+    if (expiry > Number.MAX_SAFE_INTEGER) {
+      expiry = null;
+    }
     // date before epoch time, cap to epoch
-    } else if (expires == 1) {
-      expires = 0;
+    else if (expiry < 0) {
+      expiry = 0;
     }
+
     rv.push({
       'name': cookie.name,
       'value': cookie.value,
@@ -1674,7 +1677,7 @@
       'domain': cookie.host,
       'secure': cookie.isSecure,
       'httpOnly': cookie.httpOnly,
-      'expiry': expires
+      'expiry': expiry
     });
   }
staats-google commented 7 years ago

+1, please fix.

andreastt commented 7 years ago

I’m very likely to fix this as part of https://bugzilla.mozilla.org/show_bug.cgi?id=1372595 because I have to write a WPT test for it.

pavel-morozov-duallab commented 7 years ago

Hello. I'm using the latest geckodriver (0.18.0) with firefox 55 for selenium tests. When i get cookies in my tests they have no expiry parameter at all. I thought this bug was already fixed in 0.18.0. Am i doing something wrong?

andreastt commented 7 years ago

@pavel-morozov-duallab As you can tell from https://bugzilla.mozilla.org/show_bug.cgi?id=1372595, this was fixed in Firefox 56.

lock[bot] commented 5 years ago

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.