Hi all,
My script fails due to WebElementNotFoundException randomly, but the application doesn’t change. I tried several waitFor commands and waitForPageLoad, but the result is an everything or nothing scenario. If it finds the element, it is present, clickable etc, but sometimes it is a deadend.
I need to use Internet Explorer, which is alone pain itself, furthermore I’m dealing with frames and pop-up windows.
There are a few spots where the script fails and it is on a frame or window switch or the first element after the switch.
Here is an example, where I have to dig down to a frame but I stuck a few times finding the first frame
(the “unable to verify image” error msg is a bit weird)
WebUI.waitForPageLoad(GlobalVariable.$timeout)
WebUI.switchToFrame(findTestObject(‘Object Repository/Moris/Frames/frontend_main’), GlobalVariable.$timeout)
WebUI.switchToFrame(findTestObject(‘Object Repository/Moris/Frames/frontend_maincontent’), GlobalVariable.$timeout)
WebUI.switchToFrame(findTestObject(‘Object Repository/Moris/Frames/data1’), GlobalVariable.$timeout)
the log says:
=============== ROOT CAUSE =====================
Caused by: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Moris/Frames/frontend_main’ located by ‘//*[@name = ‘frontend_main’]’ not found
For trouble shooting, please visit: https://docs.katalon.com/katalon-studio/docs/troubleshoot-common-execution-exceptions-web-test.html
08-07-2020 09:05:49 DE Test Cases/x_v0
Elapsed time: 51,139s
Test Cases/x_v0 FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to verify image ‘Object Repository/x/Frames/frontend_main’ present
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)
at com.kms.katalon.core.webui.keyword.builtin.SwitchToFrameKeyword.switchToFrame(SwitchToFrameKeyword.groovy:84)
at com.kms.katalon.core.webui.keyword.builtin.SwitchToFrameKeyword.execute(SwitchToFrameKeyword.groovy:68)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:73)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.switchToFrame(WebUiBuiltInKeywords.groovy:2895)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$switchToFrame$3.call(Unknown Source)
at x_v0.run(Babavaro_ugylet_rogzites_v0:54)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:339)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:330)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:309)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:301)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:235)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1596783946902.run(TempTestCase1596783946902.groovy:25)
Caused by: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/x/Frames/frontend_main’ located by ‘//*[@name = ‘frontend_main’]’ not found
at com.kms.katalon.core.webui.common.WebUiCommonHelper.findWebElement(WebUiCommonHelper.java:1368)
at com.kms.katalon.core.webui.keyword.builtin.SwitchToFrameKeyword$_switchToFrame_closure1.doCall(SwitchToFrameKeyword.groovy:77)
at com.kms.katalon.core.webui.keyword.builtin.SwitchToFrameKeyword$_switchToFrame_closure1.call(SwitchToFrameKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
… 17 more
here is the source:
what can I do to make this more stable?
thank you
daniel