It's the expected behaviour at this time when Katalon Studio creates the new WebDriver instances and it's the same behaviour for all of the Selenium-based tools.
When the automated test has been executed, it will create the new driver instance (FirefoxDrive, ChromeDriver, InternetExplorerDriver, SafariDriver, OperaDriver, HtmlUnitDriver..) instead of the current browser you're using in the manual test, and execute the test under the anonymous profile.
The session of a web driver instance is over once that particular instance is closed. Thus you can't access the session of the previous instance in a new one.
Reference:
-
https://docs.katalon.com/katalon-studio/docs/set-cookies-for-browsers.html
-
https://forum.katalon.com/t/fetching-cookie-from-browser-an-use-it-for-calling-rest/14389
-
https://stackoverflow.com/questions/54899900/how-to-extract-browser-cookies-using-katalon-studio
Solution 1: Opening Chrome Browser with a predefined custom Chrome Profile which stores session info such as credentials and cookies
Solution 2: Storing the session value in a variable and then adding the session in the new instance.
Ref:
-
https://docs.katalon.com/katalon-studio/docs/set-cookies-for-browsers.html
-
https://forum.katalon.com/t/fetching-cookie-from-browser-an-use-it-for-calling-rest/14389
-
https://stackoverflow.com/questions/54899900/how-to-extract-browser-cookies-using-katalon-studio
Get cookie
import com.kms.katalon.core.webui.driver.DriverFactory
driver = DriverFactory.getWebDriver()
driver.manage().getCookies() // all cookies
driver.manage().getCookieNamed(key) // part of cookies
Set/Add a cookie
WebUI.openBrowser('')
Cookie ck = new Cookie("name", "value");
WebDriver driver = DriverFactory.getWebDriver()
driver.manage().addCookie(ck)
Comments
0 comments
Please sign in to leave a comment.