Issues Saving and Reaccessing Browser Sessions

Background:

  • I am attempting to save browser sessions to an excel file so I can keep the session open and switch back to it from a different test suite later on. I was originally using global variables, but those are cleared out at the end of a test suite and cant be accessed in future test suites.

Progress:

  • I have an excel file that saves off various browser sessions
  • I have a keyword to retrieve those browser sessions in later test suites
  • I attempt to switch to a saved session in later test suites

Current Issue:

  • I believe these sessions are auto-converted from ChromeDriver sessions to Strings when saved in the excel.
  • When I attempt to switch to one of those saved sessions, I need to pass in a WebDriver session instead of a String.
  • When I try to use DriverFactory.changeWebDriver(savedSession), I get an error:

groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webui.driver.DriverFactory.changeWebDriver() is applicable for argument types: (java.lang.String) values: [ChromeDriver: chrome on MAC (60eece5a63846ce173f7a30dfb7409b8)]Possible solutions: changeWebDriver(org.openqa.selenium.WebDriver), closeWebDriver()

Potential Solutions:

  • Use something other than Excel Data File (something that can store and transfer WebDriver sessions without converting them)
  • Figure out how to convert string back to WebDriver session

Anyone have any ideas?

You can not achieve this. You can not save/reuse a browser session across the border of Test Suites. You should abandon the idea.

If I were you, I would try 2 other approaches:

  1. merge 2 Test Suites into a single Test Suite. If you want to share a browser session across a group of test cases, you should not split them into 2 Test Suites; keep them in 1.
  2. simply open a browser session per each Test Suites.

@kazurayam - Thanks for the response.

Is it not possible to either:

I was interested in this article, tried it. I created a new Gradle project, with dependency to

testImplementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.141.59'

I copy&pasted the sample code, modifiied a bit, and ran it. The code ran successfully. I found that this article is reliable.

Then I tried to re-implement the same code in Katalon Studio. I found some difficulties, and eventually gave up. The problems include:

  1. The sample code depends 2 classes
import org.openqa.selenium.remote.http.W3CHttpCommandCodec
import org.openqa.selenium.remote.http.W3CHttpResponseCodec

these are not included in the selenium-java v3.141.59 which is bundled in Katalon Studio v8.2.0. I had to find out which jar contains these 2, and get that jar from somewhere and install it in the Drivers folder of the Katalon Project.

I tried

$ gradle dependencies

to find which jar I need to add to the Katalon project. I found

// https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-remote-driver
implementation group: 'org.seleniumhq.selenium', name: 'selenium-remote-driver', version: '3.141.59'

seems to be the one. I tried it. But I got other errors … well, too difficult.

  1. The article covered only the case of ChromeDriver. FireFox is not discussed about. No Safari at all. I learned that “saving & re-accessing browser sessions” is strongly browser-type dependent.

That’s all I have done. I was not successful.

Katalon Studio bundles many external libraries that you would require for developing and running tests. It covers enough as long as you do what Katalon Teams supposed users would do. When you try to do something that Katalon Team did not expected users to do(as @jyoung) and hence require more of external dependencies, you will find it is very difficult to resolve external dependencies in Katalon Studio correctly, as Katalon Studio does not provide Maven/Gradle-like dependency management feature.