How to use Selenium WebDriver in Katalon Studio


This is a companion discussion topic for the original entry at https://docs.katalon.com/katalon-studio/tutorials/using_selenium_webdriver_katalon_studio.html

After invoking the Selenium Webdriver instance is it possible to continue recording with Katalon? My current challenge is I need to export the recording test back into IntelliJ and be able to use the captured actions without duplicating the effort that went into recording the test by having to re-write nearly every line to make it intelligible to our test library.
I haven’t figured out a way to tell katalon to simply capture xpaths and bypass the object repository-which I find personally very unwieldy. Not sure how anyone uses it practically in a fully fledged Java Dev Env. Thanks for the support and guidance.

Hi @ze2

Yes, it is possible. In fact, I think you must record with Katalon Studio and THEN change/instantiate the WebDriver in the script.

About your challenge, what test library are you using and what capabilities does it provide that Katalon lacks ? Since Katalon Studio uses Groovy - a Java-based scripting language, you can pretty much develop in Java entirely if you want.

If that’s not what you mean by Java Dev Env, then I suppose you are asking for APIs from Katalon to be called in your Java application ? If that’s the case then we are developing Katalon Platform that allows users to write plug-ins that can extend Katalon’s capabilities.

It’s not exactly an API ( in the sense of a JAR file that you can import in your test in other IDEs), but in the future you can develop plug-ins that export Katalon’s test cases into other formats. The Platform is still currently in BETA and under development, but we have published it so you may want to take a look in case existing infrastructures can help you leverage Katalon for your automation testing.

Have a nice day !

ze2

Why do you use Katalon Studio? What is the reason why you use it?

In other words, why don’t you develop a automated Web UI testing project in IntelliJ, with Groovy, Gradle, Spock, WebDriver, and Geb? What feature of Katalon Studio will you miss if you take this approach?

This is exploratory for my team. Our current set-up consists exactly of nearly all the tools you outlined. Java Dev with Intellij, Maven, JUnit unit testing etc. We use mostly Webdriver for UI/UX. I’ve been looking at Spock and now Katalon to see if we can leverage unique assets since you never know how good the neighbor has it from his lawn alone, lol. Basically the product is taking on new integration’s with other company solutions and the test automation work needs some sort of paradigm shift, hence my interest.
Also since Webdriver did away with its ‘export/export as’ feature and that potential now exists in Katalon (perhaps others also?) albeit crippled imho I was hoping to just capture user interactions to simplify the mundane aspects.
Perhaps its from inexperience with Katalon but their object repo container instead of plain xpath/css of test artifacts is counterproductive in my opinion. I don’t see the value of a container for test artifacts - that’s not the most expensive aspect of the test capture/creation process but as always my mileage varies.

ze2,

I was hoping to just capture user interactions to simplify the mundane aspects.

Have you ever tried another product Katalon Automation Recorder? It provides a feature exporting scripts.
https://docs.katalon.com/katalon-studio/videos/export_import_selenium_scripts.html

On the other hand, Katalon Studio is NOT designed to export scripts.

So am not sure what version he’s running but here are my specs
Katalon Studio | Version: 5.10.1 | Build: 1
And the menus and layout are completely different. The interface I have does not appear to capture xpath for instance which I thought was really odd, so odd I thought surely I must be doing it all wrong. I’m sure there’s some place in there to turn it on but I haven’t found it so far. [see attachment]
In script mode I can’t seem to change the preference for object references.
Webdriver IDE was intelligible to IntelliJ but you can see how those references are meaningless or at least so they’ve been to me

exporting as Groovy script.

ze2,

Every tool has its own limitations. You can define your all objects as keywords in katalon and then create katalon scripts for your test cases. When you are creating test scripts you can simply call your all objects from Keywords and can perform actions what ever is needed. For example:

    clickTestObject(TestObject to, int timeout) {
	WebDriver driver = DriverFactory.getWebDriver()
	WebElement element = WebUiCommonHelper.findWebElement(to, timeout)

The Actions link is broken (extra rel= at the end)