0

Details: 1. The browser comes up for a flash of a second and shuts down causing the next test step which is to set the cookie to fail. Error:

UnableToSetCookieError: unable to set cookie
  (Session info: chrome=77.0.3865.75)
    at Object.throwDecodedError (/usr/app/node_modules/selenium-webdriver/lib/error.js:550:15)
    at parseHttpResponse (/usr/app/node_modules/selenium-webdriver/lib/http.js:563:13)
    at Executor.execute (/usr/app/node_modules/selenium-webdriver/lib/http.js:489:26)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async thenableWebDriverProxy.execute (/usr/app/node_modules/selenium-webdriver/lib/webdriver.js:699:17)
    at async loginWithRoles (/usr/app/features/support/pages/common.js:16:3)

The code which sets the cookie is:

await driver.get(TARGET_HOST)
  await driver.manage().addCookie({
    name: 'token',
    value: tokenValue,
    httpOnly: true,
    domain: TARGET_HOST_DOMAIN,
    path: '/',
    secure: false
  })
  await driver.get(TARGET_HOST)
  return driver.manage().window().setRect({width: 1920, height: 3000})

These tests have been running fine until 13-09-2019. This coincides with the date when selenoid/chrome:latest was updated.

I am using the below docker images in the compose file: aerokube/selenoid:latest-release selenoid/video-recorder:latest-release selenoid/chrome:latest

Selenium-webdriver: 4.0.0-alpha.4

Any tips to debug would be helpful

Deepti K
  • 590
  • 2
  • 9
  • 26
  • Possible duplicate of https://stackoverflow.com/questions/45842709/unable-to-set-cookies-in-selenium-webdriver – e1che Sep 17 '19 at 15:10

1 Answers1

0

I resolved this issue by not adding domain while setting the cookies.

The code to set cookies looks like this now:

    await driver.get(TARGET_HOST)
    await driver.manage().addCookie({
    name: 'token',
    value: tokenValue,
    httpOnly: true,
    path: '/',
    secure: false
  })
  await driver.get(TARGET_HOST)

See: https://bugs.chromium.org/p/chromedriver/issues/detail?id=3141

Deepti K
  • 590
  • 2
  • 9
  • 26