How can I set cookies for my browsers in Katalon?


#1

As the title says

Thanks for help.


#2

It is quite easy:

import org.openqa.selenium.Cookie
import org.openqa.selenium.WebDriver
import com.kms.katalon.core.webui.driver.DriverFactory
Cookie ck = new Cookie("name", "value");
WebDriver driver = DriverFactory.getWebDriver()
driver.manage().addCookie(ck)

#3

@Ana Hong said:
It is quite easy:

import org.openqa.selenium.Cookie
import org.openqa.selenium.WebDriver
import com.kms.katalon.core.webui.driver.DriverFactory
Cookie ck = new Cookie(“name”, “value”);
WebDriver driver = DriverFactory.getWebDriver()
driver.manage().addCookie(ck)

Thank you


#4

hello! I have some issue. I made as you offer and I get this

FAILED because (of) org.openqa.selenium.WebDriverException: unable to set cookie

(Session info: chrome=68.0.3440.84)

(Driver info: chromedriver=2.35.528157 (4429ca2590d6988c0745c24c8858745aaaec01ef),platform=Mac OS X 10.12.6 x86_64) (WARNING: The server did not provide any stacktrace information)

How to resolve this problem?


#5

is your browser up&running?


#6

yes


#7

I am having the same problem:

FAILED because (of) org.openqa.selenium.WebDriverException: unable to set cookie

(Session info: chrome=68.0.3440.84)

(Driver info: chromedriver=2.35.528157 (4429ca2590d6988c0745c24c8858745aaaec01ef),platform=Mac OS X 10.12.6 x86_64) (WARNING: The server did not provide any stacktrace information)

Any solutions how to resolve it?

Thank you.


#8

I too am having the same issue.

11-27-2018 10:54:17 AM - [ERROR] - Test Cases/Test FAILED because (of) (Stack trace: org.openqa.selenium.WebDriverException: unable to set cookie

(Session info: headless chrome=70.0.3538.110)


#9

I found that this works only if you have navigated to a page first. Anyone know how to set cookies on a domain before your load it?