sourcegraph / go-selenium

Selenium WebDriver client for Go
https://sourcegraph.com/github.com/sourcegraph/go-selenium
Other
367 stars 73 forks source link

GetCookies sometimes fails on chromedriver #14

Closed Bowbaq closed 9 years ago

Bowbaq commented 9 years ago

It seems that when using ChromeDriver (and perhaps other drivers), sometimes the value returned for the cookie's expiry field doesn't deserialize as a uint.

For example:

[
  {
    "domain":".typeform.com",
    "expiry":1475462515.303742,
    "httpOnly":false,
    "name":"__insp_slim",
    "path":"/",
    "secure":false,
    "value":"1443926515303"
},
...
]

Notice how the expiry field has a period followed by a bunch of digits. I'm guessing this is fractions of a second?

I changed the type of Expiry to interface{} in my fork to fix the immediate issue. Maybe there is a way to detect this & handle it better though.

sqs commented 9 years ago

Thanks for reporting this. It looks like we might need to use (*encoding/json.Decoder).UseNumber and the interface{} type to ensure that precision is retained. If anyone would be willing to submit a PR for this, I would greatly appreciate it.

Bowbaq commented 9 years ago

I'm happy to make the changes, but this looks like it will break the API. Is that cool?

sqs commented 9 years ago

Fine with me. Thank you!