diff --git a/remote.go b/remote.go index 09a16cb..c867c91 100644 --- a/remote.go +++ b/remote.go @@ -10,6 +10,7 @@ import ( "errors" "fmt" "io/ioutil" + "math" "mime" "net/http" "net/url" @@ -1009,6 +1010,10 @@ func (wd *remoteWD) GetCookies() ([]Cookie, error) { } func (wd *remoteWD) AddCookie(cookie *Cookie) error { + //if cookie.Expiry is zero, AddCookie is not effective, @see https://github.com/tebeka/selenium/issues/130 + if cookie.Expiry == 0 { + cookie.Expiry = math.MaxUint32 + } return wd.voidCommand("/session/%s/cookie", map[string]*Cookie{ "cookie": cookie, })