Weekly Katalon FAQs (1) - Browser & Testing environment

:point_right: See also: Technical FAQs (2) - Test Report


:loudspeaker: FAQs listed in this topic
1. Why didn’t the expected alert get popped up through Katalon when launching Firefox?
2. How to set up Edge Chromium window size?
3. How to run tests on Brave browser?
4. How to be able to detect the WebElement on IE 11 browser?
5. What are the best practices or tips when working with headless browsers?


1. Why didn’t the expected alert get popped up through Katalon when launching Firefox?

Since by default the dom.disable_beforeunload preference variable is True which blocks the popup to generate, we need to set the dom.disable_beforeunload preference variable as False before launching Firefox.

The above preference variable is added to the firefox driver through Firefox options.

Please look at the code below for better understanding:

String browser = DriverFactory.getExecutedBrowser().getName()

if (browser.equalsIgnoreCase('FIREFOX_DRIVER')) {

System.setProperty("webdriver.gecko.driver",

DriverFactory.getGeckoDriverPath());

FirefoxOptions firefoxOptions = new FirefoxOptions();

firefoxOptions.addPreference("dom.disable_beforeunload", false); // only for firefox browser special preference is needed.

WebDriver driver = new FirefoxDriver(firefoxOptions);

driver.navigate().to(url);

DriverFactory.changeWebDriver(driver)

}else {

WebUI.openBrowser(url)

}

Here the desired capabilities option in Katalon doesn’t work because the constructor of the firefox driver accepts only firefox options as input.

2. How to set up Edge Chromium window size?

Step 1: Go to Project Settings > Desired Capabilities > Web UI > Edge Chromium then set arguments as below:

  • Name: ms:edgeOptions, Type: Dictionary, Value: Click the Add button […]
  • Name: ms:edgeChromium, Type: Boolean, Value: true

Step 2: Inside Value for Dictionary Property Builder:

  • Input “args” for Name
  • Choose List for Type

Continue to click the Add button […] for Value

Step 3: Inside Value for List Property Builder:

  • Choose String for Type
  • Input window-size=x,y for Value

Note: Change x,y to your desired dimensions, for example, 1920,1080

Note: For other Desired Capabilities (maximize, incognito, etc.), we can do the same way.

More information about Desired Capabilities: Introduction to Desired Capabilities

3. How to run tests on Brave browser?

*Brave browser is based on the Chromium browser core of Google, like Chromium Edge, so it is basically controlled by ChromeDriver. One of its advantages is blocking advertisements from all websites.

Katalon has not supported Brave browsers like Chrome and Firefox yet. However, here’s a workaround:

Step 1: Go to Project > Settings > Desired Capabilities > Custom. Create a custom for Brave like the screenshot below. The value of binary is the path to your Brave browser.

Step 2: Update Chrome WebDriver.

Step 3: Run tests with the Brave browser.

4. How to be able to detect the WebElement on IE 11 browser?

You can follow one of these solutions:

Solution 1: Follow this instruction to config Internet Explorer 11: https://docs.katalon.com/katalon-studio/docs/internet-explorer-configurations.html

Solution 2: Change the IE WebDriver from 64 to 32 bit:

  • Download and unzip the driver file: https://goo.gl/9Cqa4q
  • Replace the current IEDriverServer.exe with the new file

Solution 3: Use JavaScript Executor:

import com.kms.katalon.core.webui.common.WebUiCommonHelper as WebUiCommonHelper import org.openqa.selenium.WebElement as WebElement WebElement element = WebUiCommonHelper.findWebElement(findTestObject('Object Repository/Page_Home of Acunetix Art/a_guestbook'),30) WebUI.executeJavaScript("arguments[0].click()", Arrays.asList(element))

5. What are the best practices or tips when working with headless browsers?

In general, a headless browser is difficult to control due to non-UI. However, we have some tips to share:

TIP #1: Set the fixed browser size by using the keyword: WebUI.setViewPortSize(). For example:

WebUI.openBrowser('')

WebUI.setViewPortSize(1920,1080)

You can use this site to get your current browser size.

Besides, you can configure it from Desired Capabilities in Project Settings. For example:

TIP #2: Review the steps if there is a need to add some Delay steps:

WebUI.delay(5)

WebUI.verifyElementPresent(findTestObject('Login page/Page_Katalon Sign in/div_Which product would you like to use'), 0)

WebUI.delay(5)

TIP #3: Both versions of Browser and Driver should be the same. For example: Chrome Browser version = Chrome Driver version = 94.

TIP #4: Execute the test on different types of headless browsers such as IE, Chrome, Firefox, etc. Then, compare the results among them to make sure everything is working smoothly.

TIP #5: If you are using Katalon Studio Enterprise (the paid version), enable the browser-based recorder feature to record videos for headless executions.


:pushpin: Katalon Community technical FAQs are about common customer technical issues when using Katalon products. We filter these on our Helpdesk Portal twice every month to help Forum users get an easy approach to the solutions to similar problems.
If you’re paid customers, you can easily submit a ticket to our dedicated Support team.


:interrobang: Haven’t got your concern tackled - leave it here!


:star2: How would you rate this FAQs topic from 1 to 5?

  • 1
  • 2
  • 3
  • 4
  • 5

0 voters

4 Likes