Troubleshoot common exceptions when executing web tests

Tips

  • Please use Ctrl+F to look for the exceptions and errors you have encountered quickly.
  • If the exception you are looking for is not documented, please leave a comment below to request a proposed solution from the Katalon team.
Issue Solution
com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id ... not found.

Update WebDriver via the Katalon tool:

On the main toolbar, select Tool > Update WebDrivers > select the corresponding browser in the drop-down list.
com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id ... not found.

Try one of the following solutions to resolve the issue:

  1. Correct the element's XPath locator.
    • Open your page using Chrome.
    • Right-click on your desired test object > select Inspect.
    • In the Elements tab of DevTool, right-click on your target object and select CopyCopy XPath.
    • Open your test object in Katalon Studio > update XPath property with the copied value.
  2. You can also try optimizing your Test Object properties by referring to this document here: Optimize object identification and tools.
selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted. Add the Wait For Element Visible keyword before the one having this issue. To learn more about the Wait For Element Visible keyword, you can refer to this document here: [WebUI] Wait For Element Visible. For example:
WebUI.openBrowser('http://demoaut.katalon.com')
WebUI.waitForElementVisible(findtestObject('btn_Login'),30)
WebUI.click(findTestObject('btn_Login'))
org.openqa.selenium.InvalidElementStateException: invalid element state: Element is not currently interactable and may not be manipulated.

Try one of the following solutions to resolve the issue:

  1. Wait until the element is visible.
  2. Set a value directly using Javascript.
import com.kms.katalon.core.webui.common.WebUiCommonHelper
WebElement element = WebUiCommonHelper.findWebElement(findTestObject('your/object'),30)
WebUI.executeJavaScript("arguments[0].value='Your Value'", Arrays.asList(element))
org.openqa.selenium.WebDriverException: Element is not clickable at point (x, y). Other elements would receive the click: ...

Click on the element using the Execute Javascript keyword instead. To learn more about the Javascript keyowrd, you can refer to this document here: [WebUI] Execute JavaScript. For example:

import com.kms.katalon.core.webui.common.WebUiCommonHelper
WebElement element = WebUiCommonHelper.findWebElement(findTestObject('your/object'),30)
WebUI.executeJavaScript("arguments[0].click", Arrays.asList(element))
Timed out waiting for the driver server to start.
  • Download the correct Edge driver from the Microsoft website here: Microsoft Edge Driver based on your OS build (Go to Start > Settings > System > About and locate the number next to OS Build on the screen).
  • Copy downloaded Edge driver and replace it in existing edgedriver folder of Katalon Studio. For example: C:\\Katalon\_Studio\_Windows_64-4.8\\configuration\\resources\\drivers\\edgedriver
Unable to record on Internet Explorer.
  • Open Internet Explorer, select the Tools button, and then select Manage add-ons.
  • Under Show, select All add-ons.
  • Select the RecorderExtension.RecorderBHO add-on, Enable, and then select Close.

    Select the RecorderExtension.RecorderBHO add-on
    Click the image to enlarge it.

Unable to connect to Katalon server.

Allow the following .exe files to communicate through Windows Firewall. To learn more about allowing apps through Windows Firewall, you can refer to the Microsoft document here: Risks of allowing apps through Windows Defender Firewall.

  • geckodriver.exe
  • chromedriver.exe
  • iedriverserver.exe

These executable files can be located in: <Katalon Studio folder>\\configuration\\resources\\drivers.

Allowing chromedriver.exe through Window FireWal
Click the image to enlarge it.


Click the image to enlarge it.

You may also need to add Google Chrome (chrome.exe) and Firefox (firefox.exe) in the worst case if your current Windows Firewall blocks them as well.

Use different browser versions. In case you want Katalon Studio to use different versions besides the currently installed version, there are two ways to do it:

1. Use custom keywords. Follow these steps:

  • The browser instances you wish to use should be installed on your machine first.
  • Create a custom keyword to open the browser. Press Ctrl + Shift + O to automatically import necessary packages. To learn more about creating a custom keyword, you can refer to this document here: Introduction to Custom Keyword.
  • For example
    package com.example
    import org.openqa.selenium.WebDriver
    import org.openqa.selenium.chrome.ChromeDriver
    import org.openqa.selenium.chrome.ChromeOptions
    import org.openqa.selenium.firefox.FirefoxDriver
    import com.kms.katalon.core.annotation.Keyword
    import com.kms.katalon.core.webui.driver.DriverFactory
    public class WebUICustomKeywords {
     @Keyword
     def openFirefoxBrowser(String firefoxPath, String firefoxDriver) {
     //Set path to Firefox version
     System.setProperty("webdriver.firefox.bin", firefoxPath)
     //Set path to Firefox driver: \configuration\resources\drivers\firefox_win64\geckodriver.exe
     System.setProperty("webdriver.gecko.driver", firefoxDriver)
     WebDriver driver = new FirefoxDriver()
     DriverFactory.changeWebDriver(driver)
     }
     @Keyword
     def openChromeBrowser(String chromeDriverPath, String chromePath)
     {
    //Set path to chromedriver driver: \configuration\resources\drivers\chrome_win32\chromedriver.exe
     System.setProperty("webdriver.chrome.driver", chromeDriverPath)
     ChromeOptions options = new ChromeOptions()
     //Set path to Chrome binary
     options.setBinary(chromePath)
     WebDriver driver = new ChromeDriver(options)
     DriverFactory.changeWebDriver(driver)
     }
    }
  • In a test case, use this custom keyword instead of the Open Browser keyword.
  • For example
    CustomKeywords.'com.example.WebUICustomKeywords.openFirefoxBrowser'('C:\\Program Files\\Mozilla Firefox 52\\firefox.exe',
     'C:\\5.4\\Katalon Studio Windows 64\\configuration\\resources\\drivers\\firefox_win64\\geckodriver.exe')
    WebUI.navigateToUrl(GlobalVariable.G_SiteURL)
    WebUI.click(findTestObject('Page_CuraHomepage/btn_MakeAppointment'))
1. Downgrade browser version: Another approach is to downgrade your current browser's version to a version you want. If you want to use a very old version of your current browser, you may need to downgrade or upgrade browser drivers as well as Selenium WebDriver, you can refer to this document here: Update or Downgrade WebDrivers.
org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element is not clickable at point

1. If the test case fails because there is another object covering the target element, for example, a pop-up dialog, you can add actions to remove the object before the Click action.

2. From Katalon version 8.2.0 onwards, if the Default wait for element timeout setting is not long enough for Katalon to click on the target element behind an overlay, you can add the WebUI.waitForElementClickable keyword before the Click action. To learn more about using the WebUI.waitForElementClickable keyword, you can refer to this document here: [WebUI] Wait For Element Clickable.

 

The exception you are looking for is not on this page?

Leave a comment below.

Feedback