I would like to execute a Katalon studio script from a Java program calling it.
To achieve this I set up in Intellij a new Groovy project.
I copied all the jars from the plugins directory of the Katalon Studio Eclipse based IDE to have them available in my Groovy project.
Then I copied the intended Groovy script from Katalon Studio to Intellij, as a new Groovy file.
I saw that I had to select JDK8 instead of JDK11 to avoid some Groovy startup errors.
Next step was to avoid a null pointer exception from failure to load a ChromeDriver instance.
I wrote the following code
options = new ChromeOptions();
driver = new ChromeDriver(options);
//Link instanciated ChromeDriver to WebUI
//Use the new defined browser but it fails due to reinitialization of properties with missing config when the corresponding values should have been taken from the already instanciated ChromeDriver!
See the corresponding stack trace,
at com.kms.katalon.core.webui.driver.DriverFactory$changeWebDriver.call(Unknown Source)
So my question is how I can avoid such a call to already filled configuration options (i.e. the isEnabledPageLoadTimeout setting)?
Or, if not possible to avoid such a parasitic re-initialization call, then how can I recreate a proper configuration in my Intellij project i.e. what exactly to be copied from the Katalon Studio Eclipse environment for that?
One can have a glimpse of what The RunConfiguration code is doing from katalon-studio-testing-framework/DriverFactory.java at master · katalon-studio/katalon-studio-testing-framework · GitHub
This is complicated by the fact that a Katalon Studio project is automatically generating a GlobalVariable instance per project which itself is taken as source to fill a RunConfiguration instance.
AFAIK I’ll don’t need all that paraphernalia, but instead just avoid to redefine what is already set up from my ChromeOptions.