F
F
fandorin_official2019-07-04 19:14:02
Python
fandorin_official, 2019-07-04 19:14:02

Why did Google Chrome stop loading cookies in autotest?

In the autotest, when entering the site, in order to avoid the authorization procedure via SMS, previously saved cookies were loaded. Everything worked stably for a very long time. Yesterday. suddenly, when trying to load a cookie, an error began to appear:
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: invalid 'expiry'
It is worth noting that if you just change the browser in which the test will be run without changing the cookie loading code, then everything works successfully. But in Google Chrome, the algorithm stopped working.

browser = webdriver.Chrome()
    browser.maximize_window()
    browser.get('https://test.ru')
    with open("cookie.pkl", "rb") as cookiefile:
        cookies = pickle.load(cookiefile)
        for cookie in cookies:
            browser.add_cookie(cookie)
    return browser

Can anyone come across this? How can this be corrected?
It is important that the test goes through Chrome in windowless mode.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AllDevIT, 2019-07-08
@AllDevIT

As a temporary solution, I use the previous version of chromedriver (it works with the latest chrome, despite the version mismatch).
It would be interesting to hear the opinion of experts on what to do with it.

M
Michael, 2019-08-20
@moonz

Only this helped me:

for cookie in cookies:
        if 'expiry' in cookie:
            del cookie['expiry']

        driver.add_cookie(cookie)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question