How to use webdriver in katalon for cross browser testing

Hello,
I am using WebUI.openBrowser(’’) // to create a WebDriver instance
WebDriver driver = DriverFactory.getWebDriver()// to get an instance of WebDriver created by Katalon

then I use the driver to find element and wait for elements by id…
my test works well with chrome however it is not working with IE and Firefox
I have chosen Katalon studio because it allows cross browser testing.
Is there a way to benefit from the cross browser testing of Katalon and still use the webdriver directly.
Thanks in advance

Hello,

what error you get for IE and FF? You know that you must create a separate instance for every browser you use, right?

Hello Marek,
I just run the same test on different browsers on Katalon.
for Firefox the Element.click() doesn’t work correctly the test is a success but the element is not clicked.

That’s weird. When you click the element manually in FF, is output as expected? Maybe you can use WebUI.waitForElementClickable in your test.

Manually everything is ok on FF and IE
yes I wait for the element to be clickable
WebDriverWait wait = new WebDriverWait(driver, 20)
wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector(…))
is there a configuration that I should do for example for FF ?
(I use only the script mode for my tests and I prefer to use css selectors)

I am not aware of any special configuration needed. I see that you use WebDriver’s method, so maybe this is not a question related to Katalon. I can advise you to check, if page is fully loaded at the time of click (if all scripts did their job on the background) or if the selector is defined correctly.

It works on chrome so normally it should work on FF.
So if I understand if I use WebDriver’s method it becomes a Selenium problem and cross browsers testing may not work correctly on Katalon so I have to check for each browser separately?

All what Katalon does is that it creates an WebDriver instance (either Chrome or FF, IE, …) and it lets you work with it. You can avoid Katalon framework at all and do following:

WebDriver driver = new FirefoxDriver()
WebElement elem = driver.findElement(By.xpath(‘xxx’))
elem.click()

The result would be the same. So I think there is other issue - most probably in geckodriver or somewhere on your page.

I added a Thread.sleep() after the wait and the click() works on FF but I still have some issues for the rest of the test may be it is a problem with geckodriver
I copied the latest gecodriver under configuration\resources\drivers\firefox_win64 to be sure but the problem is still there.

@mmo

Please check the version of Firefox you have. Is it up to date?

This definitely sounds more like a driver issue and less like a Katalon issue. There are always differences in behavior between chromedriver, geckodriver, etc.

If you’re committed to ensuring that your scripts run in both browsers, I would suggest testing that your code first works in FF, then check it against Chrome. Otherwise, if it’s not a requirement that you test your app in both browsers, I would stick with one or the other (I prefer Chrome personally).

This is usually a pretty dangerous assumption. I’ve never had the same code work the same way in both browsers.

Thanks Brandon,
Yes in fact, I discovered that it is a driver issue and that I have to adapt my code to have a test that works for both.

1 Like