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/docs/using_selenium_webdriver_katalon_studio.html

We have been able to implement WebDriver in Katalon Studio to generate 2 browser sessions and switch back and forth between them when within a test case. Has anyone been successful in creating 2 browser sessions at the beginning of a test suite and then switching back and forth between them across multiple test cases within that test suite?

Hi, Can we use the groovy script generated in Katalon in selenium?

The most important thing to mention is that you do not have to create a WebDriver instance. Katalon does it for you when you call the WebUI.openBrowser keyword.

import org.openqa.selenium.WebDriver
import org.openqa.selenium.chrome.ChromeDriver
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

WebUI.openBrowser(’’)
WebDriver driver = new ChromeDriver()

In the code above, Chrome is used as an example, but you can create any other driver type such as FirefoxDriver and InternetExplorerDriver. You may also have to set a Java system property with the driver location at the start of your test (as the code below). To terminate the WebDriver instance, call driver.close().

System.setProperty(“webdriver.chrome.driver”, “C:\test\chromedriver.exe”)

In both cases, you get a new browser instance and you can use it in Katalon. The only difference is that (at this point) you cannot use Katalon WebUI keywords with your manually created WebDriver instance. For these purposes, there is a library called DriverFactory.

FYI, you can tell the DriverFactory to use your manually-created instance:

DriverFactory.changeWebDriver(driver)

Selenium WebDriver is a tool for automating web application testing, in particular, to verify that apps work as expected. It aims to provide a friendly API that’s easy to explore and understand, and easier to use than the Selenium-RC (1.0) API, which will help make your tests easier to read and maintain.

Katalon Studio uses the Selenium engine for automated testing of web applications. This means that Katalon uses the Selenium WebDriver framework and hides the complexities of dealing with WebDriver from users. You don’t have to worry about WebDriver, but instead, work with Katalon keywords only.

You can still use WebDriver directly if you prefer. Or, if you need more flexibilities than Katalon provides, you can simply write scripts working with WebDriver directly. In this article, I’ll present a few best practices to benefit from WebDriver, which may be of interest to experienced automation testers who want to work with Selenium directly.

Regards : selenium classes in pune

Hello here, I am a software tester and have joined this freelancing site that I often see job postings for QA Engineers and Testers that require knowledge in Selenium. I have decided to advance to automation testing. Now I don’t have any previous programming language so I am learning how to test with Katalon Studio and have realized it uses the Selenium engine for automated testing of web applications. So I would like to ask that after I have gained enough experience in how to use Katalon Studio, I can apply for Qa positions that require Selenium? Thank you all

If you become an “expert” in Katalon Studio specifically, I would not say that you necessarily have sufficient Selenium knowledge to feel confident in a position that requires it.

The reason is that while yes, Katalon Studio is based on Selenium, if you’re just using the built-in keywords provided to you, all of that Selenium functionality is wrapped up into a nice neat package for you and you aren’t really getting any experience with the underlying technology.

The good news is that using tools like Katalon Studio will teach you other really important skills that come into play when working with automation software like Selenium. Skills like how to use DevTools, how to write locators (xpath, CSS, etc.) to target elements in a web application, or even just how to write meaningful and consistent test cases.

But don’t be discouraged. I think Katalon Studio is a really nice place to start. It can be a kind of sandbox where you can learn the basics, then if you want to start using Selenium you’ll have to tools to do so. I would also suggest spending some time learning the Java programming language (Katalon uses a form of Java called Groovy) if your goal is to learn how to use Selenium directly.

If you have more questions/want to discuss digging into test automation as a whole, I’d be happy to guide you where I can. Feel free to DM me :slight_smile:

@asantee324

I quickly searched the Internet for an introduction to programming tests using Selenium directly in Java.

I found the following might be a good sample:

This article is labeled as “2 minutes read”. But it contains a lot of pointers to the technologies you need to be familiar with. If you can go through this article and run the sample code successfully, it would prove that you have minimum skill set for Selenium jobs.


I tried to go through this article, the sample test ran, but failed. The test could not find the ChromeDriver executable. In order to solve it, I need to find the ChromeDriver distributed somewhere on the net, download it and locate it on my PC, and let my test use it. A lot of setups required.

In fact, programming tests with Selenium requires a lot of setups before writing test codes. Also the above article assumes you to have skill for dependency management by Gradle, writing tests with JUnit in Java. Those hurdles would require you months to overcome.

I am not sure if full set of those prerequisites are required to apply to the Selenium jobs. Some managers may say yes, some may say not so much.

@asantee324

The good news is that Katalon Studio provides you an environment ready to start developing UI tests out of box. You can skip most of the setups.

In Katalon Studio, you can quickly get started with writing tests on top of Selenium. Later you can step back and learn the Selenium basics.