How to Resolve "WebElementNotFoundException" Error in Katalon Studio Recorded Test Cases?

  • I am getting every time I run my recorded test case, an error “Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: \'Object Repository/Page”
  • I followed the fix suggested for log out and used the wait for element clickable and wait for element present but with no success.
  • Please note that,on the Obj. repository, the xpath= id(\"page-wrapper\")/header[1]/section[@class=\"logo-menu\"]/div[@class=\"wrapper\"]/nav[@class=\"main-menu\"]/ul[1]/li[@class=\"has-submenu\"]/ul[@class=\"submenu\"]/li[1]/a[1]
  • How can I get the Combo Box Items, and select an option each time i want to test. Example: I have the gender drop down list contains (Male/Female) how can on the first test to use option one, and on the second run choose another option? how can I save the items of the combo?

I am getting this same error - Any advice to fix?

Hi, I am curious on the issue. Could you please take the screenshot of the Object Repository for the element?. May be the Id properties is not set correctly.

I am also getting this error, was there any resolution?
Unable to click on object ‘Object Repository/connect to Twitter2/Page_PointBurst (2)/span_Connect with’ (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/connect to Twitter2/Page_PointBurst (2)/span_Connect with’ located by ‘By.xpath: //span[count(. | //[@id = ‘dijit_form_Button_1_label’]) = count(//[@id = ‘dijit_form_Button_1_label’])][count(. | //[contains(.,‘Connect with’)]) = count(//[contains(.,‘Connect with’)])]’ not found)
11-02-2017 10:51:22 AM - [FAILED] - Test Cases/connect with Twitter2 FAILED because (of) Unable to click on object ‘Object Repository/connect to Twitter2/Page_PointBurst (2)/span_Connect with’ (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/connect to Twitter2/Page_PointBurst (2)/span_Connect with’ located by ‘By.xpath: //span[count(. | //[@id = ‘dijit_form_Button_1_label’]) = count(//[@id = ‘dijit_form_Button_1_label’])][count(. | //[contains(.,‘Connect with’)]) = count(//[contains(.,‘Connect with’)])]’ not found)

Sheri,
Could you take a screenshot of the Element property at Object Repository? (Object Repository/connect to Twitter2/Page_PointBurst (2)/span_Connect with)

I’m also getting a similar error… did anyone get a resolution??
Fail:
Unable to click on object ‘Object Repository/ICS1/Page_NICEIC Online Certification Se/a_Electrical Installation Cert’ (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/ICS1/Page_NICEIC Online Certification Se/a_Electrical Installation Cert’ located by 'By.xpath: //a[count(. | //[@href = ‘/Certificate/Edit?cdlName=ics1&part=part1’]) = count(//[@href = ‘/Certificate/Edit?cdlName=ics1&part=part1’])][count(. | //*[text() = ’

                                        Electrical Installation Certificate (Scotland)
                                                
                                    ']) = count(//*[text() = '

                                        Electrical Installation Certificate (Scotland)
                                                
                                    '])][count(. | id("certificate_124")/td[@class="certificate_name"]/a[1]) = count(id("certificate_124")/td[@class="certificate_name"]/a[1])]' not found)

Are there any solutions to this??

This thread’s issue circle around ‘WebElementNotFound’ exception, in this case it’s suggested that you adjust your Xpath or CSS based on this:
https://docs.katalon.com/pages/viewpage.action?pageId=5117668#SpyWebUtility(sinceversion5.0.0)-HowtogetwebobjectsXPathorCSSLocator

I’m getting this same error when trying to use the verifyElementPresent with an object from the repository. I had this same test in Selenium IDE and over there I’m referencing the object with it’s id, but this doesn’t seem to work with Katalon Studio. So far I’ve tried every solution proposed in all the related posts I’ve found, including the January 24th post by Vinh Nguyen found in https://docs.katalon.com/pages/viewpage.action?pageId=5117668#SpyWebUtility(sinceversion5.0.0)-HowtogetwebobjectsXPathorCSSLocator

Using the Spy Web tool I get the same locators that I’ve manually tried to introduce, and when using the ‘Verify and Highlight’ button all of them seem to work as expected, but when I save the object and then introduce the object in my test, again it can’t be found.

I’ve tried Basic selection using id, css and xpath. I’ve also tried selection using CSS and XPATH exclusively. Nothing seems to work and I always end up with the error:
com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘’ located by ‘’ not found

Any idea as to what can be happening or how can I fix this?

So, after looking everywhere for a possible explanation, I found out about the problem of finding the objects inside an iFrame that seems to affect every automation tool aside from Selenium IDE.

In case anyone else has the same problem I was having, here are a few possible solutions (#3 did it for me): https://www.katalon.com/resources-center/tutorials/handling-iframe-issue/

2 Likes

thanks @Lina Kuratomi this solution solved my issue also since we need to switch to the active iframe the we can click on the elements under that iframe

Please how can i get this sorted out. It has been giving me issues, thereby causing my test to fail. Please i need help.

WebUI.openBrowser(‘’)

WebUI.navigateToUrl(‘https://www.kobo360.com/’)

WebUI.setText(findTestObject(‘Kobo Auto Defense Repo/Page_Kobo 360 - Partner - Sign In/input_Email address_email’), ‘miracleosuji2@gmail.com’)

WebUI.setEncryptedText(findTestObject(‘Kobo Auto Defense Repo/Page_Kobo 360 - Partner - Sign In/input_Password_password’),
‘NZIV0dQRKOZ4ikMaJO1NxQ==’)

WebUI.click(findTestObject(‘Kobo Auto Defense Repo/Page_Kobo 360 - Partner - Sign In/button_SIGN IN’))

WebUI.click(findTestObject(‘Kobo Auto Defense Repo/Page_Omititun - Accepted Requests/span_Accepted Requests’))

WebUI.click(findTestObject(‘Kobo Auto Defense Repo/Page_Omititun - Accepted Requests/span_Allocated Trucks’))

WebUI.click(findTestObject(‘Kobo Auto Defense Repo/Page_Omititun - Accepted Requests/span_Income Transactions’))

WebUI.click(findTestObject(‘Kobo Auto Defense Repo/Page_Omititun - Accepted Requests/span_Trips’))

WebUI.click(findTestObject(‘Kobo Auto Defense Repo/Page_Omititun - Analytics/span_Customer Requests’))

WebUI.click(findTestObject(‘Kobo Auto Defense Repo/Page_Omititun - Customers/span_Customers’))

WebUI.closeBrowser()

THIS IS THE ERROR MESSAGE DISPLAYED.
Caused by: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Kobo Auto Defense Repo/Page_Kobo 360 - Partner - Sign In/input_Email address_email’ located by ‘//input[@name=‘email’]’ not found.

Hi there, :wave:

Thank you very much for your topic! It may take a little while before Katalon team member or others forum members respond to you.

In the meantime, you can double-check your post to see if you can add any extra information i.e. error logs, HTML codes, screenshots, etc. Check out this posting guide to help us help you better!

Thanks! :sunglasses:
Katalon Community team

As has been suggested in the above posts, you sometime need to pause your test script in order for your NETWORK to catch up to the speed of your code. So, perhaps, you can insert the pauses I have added below.

WebUI.openBrowser('')

WebUI.navigateToUrl('https://www.kobo360.com/')

WebUI.waitForPageLoad(10)   // delay here

// and I have added another safety delay here
WebUI.waitForElementVisible(findTestObject('Kobo Auto Defense Repo/Page_Kobo 360 - Partner - Sign In/input_Email address_email'), 10)

WebUI.setText(findTestObject('Kobo Auto Defense Repo/Page_Kobo 360 - Partner - Sign In/input_Email address_email'), 'miracleosuji2@gmail.com')

WebUI.setEncryptedText(findTestObject('Kobo Auto Defense Repo/Page_Kobo 360 - Partner - Sign In/input_Password_password), 'NZIV0dQRKOZ4ikMaJO1NxQ==')

WebUI.click(findTestObject('Kobo Auto Defense Repo/Page_Kobo 360 - Partner - Sign In/button_SIGN IN'))

WebUI.waitForPageLoad(10)   // delay here also

WebUI.waitForElementVisible(findTestObject('Kobo Auto Defense Repo/Page_Omititun - Accepted Requests/span_Accepted Requests'), 10)

WebUI.click(findTestObject('Kobo Auto Defense Repo/Page_Omititun - Accepted Requests/span_Accepted Requests'))

WebUI.click(findTestObject('Kobo Auto Defense Repo/Page_Omititun - Accepted Requests/span_Allocated Trucks'))

WebUI.click(findTestObject('Kobo Auto Defense Repo/Page_Omititun - Accepted Requests/span_Income Transactions'))

WebUI.click(findTestObject('Kobo Auto Defense Repo/Page_Omititun - Accepted Requests/span_Trips'))

WebUI.waitForPageLoad(10)   // I assume there is a page change here also

WebUI.waitForElementVisible(findTestObject('Kobo Auto Defense Repo/Page_Omititun - Analytics/span_Customer Requests'), 10)

WebUI.click(findTestObject('Kobo Auto Defense Repo/Page_Omititun - Analytics/span_Customer Requests'))

WebUI.waitForPageLoad(10)   // I assume there is a page change here also

WebUI.click(findTestObject('Kobo Auto Defense Repo/Page_Omititun - Customers/span_Customers'))

WebUI.closeBrowser()

I work on Regression Testing, so I also verify that radio button and checkbox objects have been clicked when I wanted them to and ensure the text is set when I add text to an input, or textarea, field, but this is not necessary.
WebUI.verifyElementChecked(findTestObject(‘…’), 10)
WebUI.verifyElementNotChecked(findTestObject(‘…’), 10)
WebUI.verifyElementAttributeValue(findTestObject(‘…’), “value”, “text entered”, 10)

Thank you for your response. However it failed again. What else can i do please?

See script below.

WebUI.openBrowser(‘’)

WebUI.navigateToUrl(‘https://www.kobo360.com/’)

WebUI.waitForPageLoad(10)

WebUI.waitForElementVisible(findTestObject(‘Kobo Auto Defense Repo/Page_Kobo 360 - Partner - Sign In/input_Email address_email’),
10)

WebUI.setText(findTestObject(‘Kobo Auto Defense Repo/Page_Kobo 360 - Partner - Sign In/input_Email address_email’), ‘miracleosuji2@gmail.com’)

WebUI.setEncryptedText(findTestObject(‘Kobo Auto Defense Repo/Page_Kobo 360 - Partner - Sign In/input_Password_password’),
‘NZIV0dQRKOZ4ikMaJO1NxQ==’)

WebUI.click(findTestObject(‘Kobo Auto Defense Repo/Page_Kobo 360 - Partner - Sign In/button_SIGN IN’))

WebUI.waitForPageLoad(10)

WebUI.waitForElementVisible(findTestObject(‘Kobo Auto Defense Repo/Page_Kobo 360 - Partner - Sign In/input_Email address_email’),
10)

WebUI.click(findTestObject(‘Kobo Auto Defense Repo/Page_Omititun - Accepted Requests/span_Accepted Requests’))

WebUI.click(findTestObject(‘Kobo Auto Defense Repo/Page_Omititun - Accepted Requests/span_Allocated Trucks’))

WebUI.click(findTestObject(‘Kobo Auto Defense Repo/Page_Omititun - Accepted Requests/span_Income Transactions’))

WebUI.click(findTestObject(‘Kobo Auto Defense Repo/Page_Omititun - Accepted Requests/span_Trips’))

WebUI.waitForPageLoad(10)

WebUI.waitForElementVisible(findTestObject(‘Kobo Auto Defense Repo/Page_Omititun - Analytics/span_Customer Requests’), 10)

WebUI.click(findTestObject(‘Kobo Auto Defense Repo/Page_Omititun - Analytics/span_Customer Requests’))

WebUI.waitForPageLoad(10)

WebUI.click(findTestObject(‘Kobo Auto Defense Repo/Page_Omititun - Customers/span_Customers’))

WebUI.closeBrowser()

See Error message below

Caused by: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Kobo Auto Defense Repo/Page_Kobo 360 - Partner - Sign In/input_Email address_email’ located by ‘//*[@id=“loginForm”]/div[1]/div/div/div[1]/div/input’ not found

For trouble shooting, please visit: https://docs.katalon.com/katalon-studio/docs/troubleshooting.html

================================================

08-30-2024 10:38:13 AM Test Cases/Kobo Auto Defense Manual

Elapsed time: 1m - 31.705s

Test Cases/Kobo Auto Defense Manual FAILED.

Reason:

com.kms.katalon.core.exception.StepFailedException: Unable to set text ‘miracleosuji2@gmail.com’ of object ‘Object Repository/Kobo Auto Defense Repo/Page_Kobo 360 - Partner - Sign In/input_Email address_email’

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:85)

at com.kms.katalon.core.webui.keyword.builtin.SetTextKeyword.execute(SetTextKeyword.groovy:39)

at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:74)

at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.setText(WebUiBuiltInKeywords.groovy:1019)

at Kobo Auto Defense Manual.run(Kobo Auto Defense Manual:29)

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:448)

at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:439)

at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:418)

at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:410)

at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:285)

at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:137)

at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:128)

at TempTestCase1725010685998.run(TempTestCase1725010685998.groovy:25)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

Caused by: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Kobo Auto Defense Repo/Page_Kobo 360 - Partner - Sign In/input_Email address_email’ located by ‘//*[@id=“loginForm”]/div[1]/div/div/div[1]/div/input’ not found

at com.kms.katalon.core.webui.common.WebUiCommonHelper.findWebElement(WebUiCommonHelper.java:1426)

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:53)

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)

… 18 more

I was able to get the username into your form but I also started in another form than the one that has the login information. What I did is below:

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testobject.ConditionType as ConditionType
import com.kms.katalon.core.testobject.TestObject as TestObject

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

import internal.GlobalVariable as GlobalVariable

/**
 * Helper function that creates a new TestObject with xpath
 *
 * @param pathway to the element
 * @return this test object led to by the pathway
 */
private TestObject newTestObject(String xpath) {
	TestObject to = new TestObject(xpath)
	to.addProperty('xpath', ConditionType.EQUALS, xpath)
	return to
}


WebUI.openBrowser('')
WebUI.maximizeWindow()
WebUI.navigateToUrl('https://www.kobo360.com/')

WebUI.waitForPageLoad(10)

myMenuItem = newTestObject('//div[text()="TRANSPORTERS"]')
WebUI.click(myMenuItem)

myLogin = newTestObject('//a[text()="Log in"]')
WebUI.waitForElementVisible(myLogin, 10)
WebUI.click(myLogin)
WebUI.waitForPageLoad(10)

WebUI.switchToWindowIndex(1)

//WebUI.waitForElementVisible(findTestObject('Kobo Auto Defense Repo/Page_Kobo 360 - Partner - Sign In/input_Email address_email'), 10)
//WebUI.setText(findTestObject('Kobo Auto Defense Repo/Page_Kobo 360 - Partner - Sign In/input_Email address_email'), 'miracleosuji2@gmail.com')
input_Email_address_email = newTestObject('id("loginForm")//input[@name="email"]')
WebUI.waitForElementVisible(input_Email_address_email, 10)
WebUI.setText(input_Email_address_email, 'miracleosuji2@gmail.com')

//WebUI.setEncryptedText(findTestObject('Kobo Auto Defense Repo/Page_Kobo 360 - Partner - Sign In/input_Password_password'),
//'NZIV0dQRKOZ4ikMaJO1NxQ==')
input_Password_password = newTestObject('id("loginForm")//input[@name="password"]')
WebUI.setEncryptedText(input_Password_password, 'NZIV0dQRKOZ4ikMaJO1NxQ==')

//WebUI.click(findTestObject('Kobo Auto Defense Repo/Page_Kobo 360 - Partner - Sign In/button_SIGN IN'))
button_SIGN_IN = newTestObject('//button[@type="submit"]')
WebUI.waitForElementClickable(button_SIGN_IN, 10)
WebUI.click(button_SIGN_IN)
WebUI.waitForPageLoad(10)

Edit: you might use the pathways that I made in the code above to see if that helps you to login to your form.