Element Click Intercepted Exception
In this type of exception, you cannot click on one or more components of your website. However, you can see them. Quite frustrating, right?
It is one of the commonly occurring exceptions and generally appears as
org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element is not clickable at point
Solution
-
Carefully check whether the target element you want to select is covered. It might be possible that some other component overlaps your target element. For example, if you add some text over an image, it gets selected repeatedly instead of the image. The solution to this is pretty simple. Add actions to remove that overlapping element before the Click action completes.
-
In Katalon, you can find the Default wait for element timeout in settings. This setting sets the default timeout period for Katalon to wait for the application and its components to load. It might be possible that the wait time is not long enough to load the element behind the overlay. If this is the case, then you can add the WebUI.waitForElementClickable keyword before the click action.
Element not Visible Exception
This exception is an improvisation of the previous one. Now, the element itself is not visible. This problem mainly arises because some components take more time to load. This kind of exception occurs if Katalon starts executing the test before the elements load entirely. When this exception occurs, the user observes the following throwback:
selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted .
Solution
We need to ask Katalon not to start the execution until the target element loads completely.
Wait For Element Visible keyword is used for this purpose. Adding it before the target element will resolve the issue.
Consider the example below:
WebUI.openBrowser('https://www.codingninjas.com/courses')
WebUI.waitForElementVisible(findtestObject(‘Enroll_btn'),15)
WebUI.click(findTestObject('Enroll_btn'))
Invalid Element State Exception
Can you expect a bulb to light up when the switch is off? Or can you expect a sleeping man to jog? Weird right? The same is the case with this exception. When we try to perform a specific operation on an element and its state does not support that operation, then this error occurs. For example, Clicking a component that is not clickable or treating the input bar as a button. It might also be true that the element is not yet correctly loaded or is disabled.
You will encounter the following throwback in this case:
org.openqa.selenium.InvalidElementStateException: invalid element state: Element is not currently interactable and may not be manipulated.
it can be solved using the following approach:
Solution
You can use one of the following methods to solve the issue:
-
Wait until the element is visible.
-
If just waiting does not do, you can use a more brute-force approach and do the required operation directly using javascript. Use the executeJavaScript keyword to write javascript. For example, if you want to set a particular value to your element:
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))
Timed Out Waiting For the Driver Server to Start
Drivers are the programs that control the operation and functioning of applications.
In this case, your server’s driver is either outdated or incompatible with your application.
Therefore, you need to download the updated version of your driver again, which is compatible with your system’s operating system.
Solution:
-
Download the correct Microsoft Edge driver from its website here: Microsoft Edge Driver based on your OS build.
-
Go to Start > Settings > System > About and locate the number next to the OS Build on the screen.
-
Copy the downloaded Edge driver and replace it in the existing edge driver folder of Katalon Studio. For example, C:\\Katalon\_Studio\_Windows_64-4.8\\configuration\\resources\\drivers\\edgedriver.
Unable to connect to the Katalon server
If you are having trouble connecting to Katalon’s server, then the first thing to do is check your internet connection. Make sure that you have access to fast and unrestricted internet.
If you have done already, there is probably an issue with your Windows defender.
Considering security issues as the prime focus, the firewall prevents specific crucial files from operating. However, this is no big deal for our ninjas!
Solution
You can start by checking whether your Firewall is blocking the web browsers.
If yes, you must add their respective exe files to the Firewall’s dictionary.
You should then allow the following .exe files to bypass the Firewall. These are the vital driver programs that interact with Katalon’s server.
- geckodriver.exe
- chromedriver.exe
-
iedriverserver.exe
These executable files can be located in the following:
<katalon studio folder>\\configuration\\resources\\drivers.
Unable to record on Internet Explorer
All you need to do is enable or install a recorder extension in your browser. This method works for all browsers, not just Internet Explorer specifically.
Solution(in the case of internet explorer)
-
Open Internet Explorer, select the Tools button, and then select Manage add-ons.
-
Under Show, select All add-ons.
-
Select RecorderExtension.RecorderBHO add-on, Enable, and then select Close.
For Chrome, go to Settings > Extensions > Recorder. You can install a recorder application according to your requirements.
Use Different Browser Versions
If you want Katalon Studio to use different browser versions besides the currently installed version, there are two ways to do it.
1. You can use custom keywords. To use this method, the browser instances you wish to use should be installed on your machine first.
2. Create a custom keyword to open the browser. Press Ctrl + Shift + O to import necessary packages automatically.
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)
}
}
3. In a test case, use the newly created keyword.
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('CodingNinjasHomepage/EnrollNinja'))
You can also downgrade the browser version.
If you want to use a relatively old version of your current browser, you may need to downgrade or upgrade browser drivers and the Selenium WebDriver.
WebDriver exception: Element is not clickable at point (x, y)
This exception is similar to the click-intercepted exception. An overlay of one or more components probably covers your target component. So the simplest thing to do is use javascript to target click that particular element.
In this type of exception, you will encounter the following throwback:
org.openqa.selenium.WebDriverException: Element is not clickable at point (x, y). Other elements would receive the click: <overlaying element>.
Solution
Click on the element using the Execute Javascript keyword instead.
For example:
import com.kms.katalon.core.webui.common.WebUiCommonHelper
WebElement element = WebUiCommonHelper.findWebElement(findTestObject('Courses_btn
WebUI.executeJavaScript("arguments[0].click()", Arrays.asList(element))
Web element Not Found Exception.
This exception arises when the element you are searching for is addressed incorrectly.
The findElement command uniquely identifies and retrieves the elements within the web page. Here, Xpath provides the exact location of a particular component based on its class or id. Incorrect entering of Xpath thus addresses void and, hence, no element is found.
Throwback:
com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id <element id> not found.
Solution
-
Open your page using Chrome.
-
Right-click on your desired test object and select Inspect.
-
In the Elements tab of DevTool, right-click on your target object and select Copy > Copy XPath. This way, you can copy the correct Xpath corresponding to the target element.
-
Open your test object in Katalon Studio and update your XPath property with the copied value.
As stated several times above, outdated web drivers may create many problems for you. Hence, it is always advisable to keep your drivers updated.
Select Tool > Update WebDrivers and then select the browser whose driver is to be updated.
Frequently Asked Questions
What is Katalon Studio?
The automation testing software tool Katalon Studio was created by Katalon, Inc. It was initially released in the year 2015. It is built on top of the open-source Selenium and Appium automation frameworks with a specialized IDE interface.
This Software as a Service (SaaS) is mainly used to create automated test scripts for UI without coding.
Is using Katalon Studio hard? What skills are pre-required?
Katalon Studio is a basic, easy automation testing solution. It does not need super programming abilities to create automated tests. It has a scripting mode for more experienced users and test cases.
What framework is used in Katalon Studio?
Groovy, a Java-based language, is used by Katalon Studio. It requires loading numerous libraries to parse test data, objects, and logging.
Conclusion
Hey ninja! As a summary, we discussed various types of exceptions that you can expect to occur while web automated testing in Katalon Studio. We thoroughly explored the reasons for the occurrence and the solution to these exceptions.
We sincerely hope the above discussion helped you understand how to detect and resolve various errors and exceptions while dealing with Web Automated testing in Katalon Studio.
If you wish to learn more about Katalon and its various testing divisions, you can refer to blogs on web services test design, mobile test design, webUI testing, and projects.
Visit our website to read more such blogs. Make sure you enroll in our courses. You can take mock tests, solve problems, and interview puzzles. Also, you can check out some interesting interview stuff- interview experiences and an interview bundle for placement preparations. Do upvote our blog to help fellow ninjas grow.
Keep Grinding! 🦾
Happy Coding! 💻