Katalon Studio is unable to handle StaleElementReferenceException
. Despite implementing try-catch blocks using both the StaleElementReferenceException
class and the generic Exception
class, the exception is not caught, and the catch
block is never executed.
This issue is critical for handling dynamic elements in real-world testing scenarios, and it disrupts the reliability of automated tests.
Steps to Reproduce:
- Use the following code block in a test case
try {
String text = SmartUIValidator.getText(findTestObject(“Dev/HomePage/NonNavigationBar/AccountBalance/accountBalanceIntegerAmount”), 30, FailureHandling.CONTINUE_ON_FAILURE, “”);
System.out.println(“accountBalanceIntegerAmount :” + text);
} catch (StaleElementReferenceException e) {
System.out.println(“StaleElementReferenceException in my test case.”);
}
Replace the catch
block with:
catch (Exception e) {
System.out.println(“Stale Element Exception.”);
}
Expected Results:
The catch
block should execute and log the appropriate message when the exception occurs.
Actual Results:
The catch
block does not execute, and the following error is returned:
Caused by: org.openqa.selenium.StaleElementReferenceException: Cached elements ‘By.xpath: //*[@content-desc = ‘testID-master-amount-main’ or @accesibilityID = ‘testID-master-amount-main’ or @label = ‘testID-master-amount-main’ or @name = ‘testID-master-amount-main’]’ do not exist in DOM anymore
For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/
Build info: version: ‘3.141.59’, revision: ‘unknown’, time: ‘unknown’
System info: host: ‘DESKTOP-XOAXXX’, ip: ‘xxx.168.125.152’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘17.0.7’
Driver info: com.kms.katalon.core.appium.driver.SwipeableAndroidDriver
Number of Affected Users:
Potentially all users testing applications with dynamic web/mobile elements.
Environment (for Mobile Testing):
- Appium Version: 2.12.1
- Mobile Platform/Version: Android 13
- Real Device or Emulator: Real device (Samsung Galaxy Note 20)
Request:
This issue was raised as early as October 2023 for web, and no resolution or workaround has been provided since then. Long delays like this are frustrating, especially for recurring issues.
Community Note:
I encourage other users to vote on this topic to help prioritize this issue.
Looking forward to a prompt resolution.
Best Regards,