Element not found exception

Tell me the solution for this.from 2 days i am facing the sane issue. Thanks

Silk (1)/span_New Stores’ (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/demorecord/Page_Swan Silk (1)/span_New Stores’ located by ‘By.xpath: //span[count(. | /html[1]/body[@class=“page-header-fixed page-quick-sidebar-over-content page-style-square”]/div[@class=“page-container”]/div[@class=“page-sidebar-wrapper”]/div[@class=“page-sidebar navbar-collapse collapse”]/ul[@class=“page-sidebar-menu”]/li[4]/a[1]/span[@class=“title”]) = count(/html[1]/body[@class=“page-header-fixed page-quick-sidebar-over-content page-style-square”]/div[@class=“page-container”]/div[@class=“page-sidebar-wrapper”]/div[@class=“page-sidebar navbar-collapse collapse”]/ul[@class=“page-sidebar-menu”]/li[4]/a[1]/span[@class=“title”])]’ not found)

1 Like

hi, u need to give proper xpath.First take the xpath from firebug,then go to Object repository ,then go to that page ,double click on the element which is giving error(“Element not found”),then right side “Add”>>Xpath>>paste the xpath,then “Ok”

I am having same issue and can’t find the solution. Please tell me how you resolved that? I am waiting for your reply.

thanx Katalon team,now my issue is resolved.

I tried the same,i copied the xpath of that particular element,after that i opened Object Repository/demorecord/Page_Swan Silk (1)/span_New Stores,and i select xpath n saved.

Unable to click on object ‘Object Repository/demorecord/Page_Swan Silk (1)/span_New Stores’ (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/demorecord/Page_Swan Silk (1)/span_New Stores’ located by ‘By.xpath: //span[count(. | //[text() = ‘New Stores’]) = count(//[text() = ‘New Stores’])][count(. | html/body/div[3]/div[1]/div/ul/li[4]/a) = count(html/body/div[3]/div[1]/div/ul/li[4]/a)]’ not found)

Hi Ashwary,

You need to set active proprety (click on the “x”) on xpath only and unset others.

Thanks.

1 Like

Hi Ashwary,

This is a common problem that your element (Object Repository/demorecord/Page_Swan Silk (1)/span_New Stores)'s xpath is not correct. You need to correct it and replace with new xpath value in Test Object View

Tips for dummy user when identifing xpath:

1.Open your page using Chrome.
2.Right-click on your desired test object -> choose Inspect Element.
3.In Chrome’s Elements tab, right-click on the focused object, choose Copy -> Copy XPath.
4.Open your test object in Katalon, modify xpath property with the coppied value.

Thanks.

1 Like

I’m having a similar problem when verifying if an objects exists

if(WebUI.verifyElementPresent(findTestObject(‘mymail.com/Page_MailTester.com/td_E-mail address is valid’), 20,FailureHandling.CONTINUE_ON_FAILURE)){

    ws.getRow(i).createCell(15).setCellValue('email valid');

}

else{

     ws.getRow(i).createCell(15).setCellValue('invalid');

}

it works when it’s valid but throws com.kms.katalon.core.webui.exception.WebElementNotFoundException if it doesn’t

I just want to see if it’s there and continue

1 Like

Angela Hoeltje said:

I’m having a similar problem when verifying if an objects exists

I’m having the same issue, using the verifyElementPresent() method too, with FailureHandling.CONTINUE_ON_FAILURE.
Have you found a solution?

UPD: ok I found it. We needed to use FailureHandling.OPTIONAL so that it doesn’t return an Error but only a Warning.

1 Like

Hi, I m having a problem using clickOffset in a loop, as it is trying to locate the object in a frame using By.xpath even though I have unchecked them in the ‘detect object by’ .

Any help much appreciated, Thanks!

Hi duyluong,
I have same error. I edited xpath . But issue not fixed.
Error :

07-25-2019 03:00:46 PM Test Cases/Testcase 1

Elapsed time: 1m - 10.562s

Test Cases/Testcase 1 FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to set text ‘Test 25/07/2019’ of object ‘Object Repository/Page_Service infra management/textarea_Add New Virtual Server_form-control ng-untouched ng-valid ng-dirty’
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.SetTextKeyword.setText(SetTextKeyword.groovy:66)
at com.kms.katalon.core.webui.keyword.builtin.SetTextKeyword.execute(SetTextKeyword.groovy:37)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.setText(WebUiBuiltInKeywords.groovy:950)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$setText$0.call(Unknown Source)
at Testcase 1.run(Testcase 1:22)
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:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
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 TempTestCase1564041641244.run(TempTestCase1564041641244.groovy:21)
Caused by: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Page_Service infra management/textarea_Add New Virtual Server_form-control ng-untouched ng-valid ng-dirty’ located by ‘By.xpath: (.//*[normalize-space(text()) and normalize-space(.)=‘Add New Virtual Server’])[1]/following::textarea[1]’ not found
at com.kms.katalon.core.webui.common.WebUiCommonHelper.findWebElement(WebUiCommonHelper.java:1097)
at com.kms.katalon.core.webui.keyword.internal.WebUIAbstractKeyword.findWebElement(WebUIAbstractKeyword.groovy:27)
at com.kms.katalon.core.webui.keyword.internal.WebUIAbstractKeyword.findWebElement(WebUIAbstractKeyword.groovy:26)
at com.kms.katalon.core.webui.keyword.builtin.SetTextKeyword$_setText_closure1.doCall(SetTextKeyword.groovy:51)
at com.kms.katalon.core.webui.keyword.builtin.SetTextKeyword$_setText_closure1.call(SetTextKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
… 17 more

Please help me :slight_smile:

Hi,

Please modify your code like below

if(WebUI.verifyElementPresent(findTestObject(‘mymail.com/Page_MailTester.com/td_E-mail address is valid’), 20,FailureHandling.OPTIONAL))

instead of using FailureHandling.CONTINUE_ON_FAILURE use FailureHandling.OPTIONAL within IF statement.
It will not throw the error.