Unable to find the element

Sorry for the maybe silly question but I just started trying Katalon Studio. Creating a testcase for our web app. I recorded and succesfully run login but now I cannot click an element form the “menu”, getting this error message:

03-08-2019 03:08:53 PM click(findTestObject(“Page_easyJOB EUD (Martin Votzi)/a_Stammdaten”))

Elapsed time: 31,609s

click(findTestObject(“Page_easyJOB EUD (Martin Votzi)/a_Stammdaten”)) FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to click on object ‘Object Repository/Page_easyJOB EUD (Martin Votzi)/a_Stammdaten’
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:48)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:65)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:27)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:86)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:67)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$3.call(Unknown Source)
at ej login old.run(ej login old:34)
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:331)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:322)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:301)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:293)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:227)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.keyword.builtin.CallTestCaseKeyword$_callTestCase_closure1.doCall(CallTestCaseKeyword.groovy:59)
at com.kms.katalon.core.keyword.builtin.CallTestCaseKeyword$_callTestCase_closure1.call(CallTestCaseKeyword.groovy)
at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:66)
at com.kms.katalon.core.keyword.builtin.CallTestCaseKeyword.callTestCase(CallTestCaseKeyword.groovy:81)
at com.kms.katalon.core.keyword.builtin.CallTestCaseKeyword.execute(CallTestCaseKeyword.groovy:44)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
at com.kms.katalon.core.keyword.BuiltinKeywords.callTestCase(BuiltinKeywords.groovy:334)
at lief Rabatt weitergeben.run(lief Rabatt weitergeben:16)
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:331)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:322)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:301)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:293)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:227)
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 TempTestCase1552054102268.run(TempTestCase1552054102268.groovy:21)

Any help would be appreciated. thx in advance. Martin

1 Like

Hi Martin -

So its telling us that its unable to click on the object, with a current bug in the latest version the error log isnt as detailed so its hard to tell exactly what is causing this but try adding a 5 second delay before the step. Also double check the xpath of the element, maybe trying changing it to search for the element using attributes if it has a name it can identify the element from.

If these dont work can you please take a screenshot of the page it is attmepting to click and also share your script steps.

Thanks

1 Like

Hello,

a bit better solution will be use of waitForElementClickable() function. it’s good habit that will speedup overall execution of tests

1 Like

Both of you are right, IMO. I commonly use an explicit delay just to investigate whether I have a timing issue or not. If the explicit delay works, then you should take the time to properly configure a more targeted wait condition. If it doesn’t, then you know that you probably don’t have a timing issue, and you can spend your time investigating other things.

3 Likes

Also, you may try, wait_for_page_load, or from the setting change the seconds between each steps for 2 seconds, but will take more time to complete any suite.

You can also use, wait for element visible.

Hi hpulsford,

didn’t find any time last week but no going on:

  • I added a waiting time of 5 seconds but it didn’t help
  • I changed the span “Stammdaten” to “no root” and click works but wait for element doesn’t
  • I did the same for span Lieferanten, same effect
  • I tried the same for the submenu, clicking on a_Lieferanten, unfortunately it failed

thx in advance for any advise, Martin

here is the script:
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable

WebUI.callTestCase(findTestCase(‘ej login’), [:], FailureHandling.STOP_ON_FAILURE)

not_run: WebUI.delay(5)

WebUI.click(findTestObject(‘Page_easyJOB EUD (Martin Votzi)/span_Stammdaten’))

WebUI.waitForElementHasAttribute(findTestObject(‘Page_easyJOB EUD (Martin Votzi)/span_Lieferanten (1)’), ‘menuToolbar_Menu_Stammdaten_subMenuLieferanten_entryLbl’,
3)

WebUI.click(findTestObject(‘Page_easyJOB EUD (Martin Votzi)/span_Lieferanten (1)’))

WebUI.waitForElementHasAttribute(findTestObject(‘Page_easyJOB EUD (Martin Votzi)/a_Lieferanten’), ‘menuToolbar_Menu_Stammdaten_subMenuLieferanten_ctl00_entryStammLieferanten_entryLb’,
3)

WebUI.click(findTestObject(‘Page_easyJOB EUD (Martin Votzi)/a_Lieferanten’))

WebUI.switchToWindowTitle(‘Lieferanten - easyJOB EUD (Martin Votzi)’)

WebUI.doubleClick(findTestObject(‘Object Repository/div_AusWi Verlag AG’))

WebUI.switchToWindowTitle(‘Lieferantenstamm - easyJOB EUD (Martin Votzi)’)

WebUI.click(findTestObject(‘Object Repository/input_Rabatt Eingabe ist nicht numerisch._Masterdetailtstab_BasecbRabattWeitergeben’))

WebUI.setText(findTestObject(‘Object Repository/input_Rabatt-_Masterdetailtstab_BasetxtRabat’), ‘5’)

WebUI.click(findTestObject(‘Object Repository/input_numerische Referenz 2 Eingabe ist nicht numerisch._MasterdetailcmdOK’))

WebUI.click(findTestObject(‘Object Repository/input_numerische Referenz 2 Eingabe ist nicht numerisch._MasterdetailcmdOK’))

WebUI.selectOptionByValue(findTestObject(‘Object Repository/select_0000 - Drittl(-)2000 - A201000 - A10’), ‘2’, true)

WebUI.click(findTestObject(‘Object Repository/input_numerische Referenz 2 Eingabe ist nicht numerisch._MasterdetailcmdOK’))

WebUI.click(findTestObject(‘Object Repository/input_numerische Referenz 2 Eingabe ist nicht numerisch._MasterdetailcmdOK’))

WebUI.switchToWindowTitle(‘Lieferanten - easyJOB EUD (Martin Votzi)’)

WebUI.click(findTestObject(‘Object Repository/img_Neue E-Mails in folgenden Mailboxen_Master_imgClose’))


and here the most current log:
03-18-2019 12:14:09 PM click(findTestObject(“Page_easyJOB EUD (Martin Votzi)/a_Lieferanten”))

Elapsed time: 31,841s

click(findTestObject(“Page_easyJOB EUD (Martin Votzi)/a_Lieferanten”)) FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to click on object ‘Object Repository/Page_easyJOB EUD (Martin Votzi)/a_Lieferanten’
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:48)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:65)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:27)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:86)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:67)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$3.call(Unknown Source)
at lief Rabatt weitergeben.run(lief Rabatt weitergeben:30)
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:331)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:322)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:301)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:293)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:227)
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 TempTestCase1552907611679.run(TempTestCase1552907611679.groovy:21)


and here the screenshot with opened submenu:

Ok so first off - this line is not correct

You do not need has attribute - your simply waiitng for the element to be visible once you have clicked on the drop down so change it too

WebUI.wiatForElementVisible(findTestObject(‘Page_easyJOB EUD (Martin Votzi)/span_Lieferanten (1)’))

PS. You need to do this for the other lines in your script aswell that have element attribute

Also after that 5 second delay is the page fully loaded? does it need more time to be able to click on it? for now just make it a 20 second delay to make sure that you rule out any loading issues

Hi,
I changed the script as suggested by you but ended up with the same failure.

Relevant part of script:
WebUI.callTestCase(findTestCase(‘ej login’), [:], FailureHandling.STOP_ON_FAILURE)

WebUI.delay(20)

WebUI.click(findTestObject(‘Page_easyJOB EUD (Martin Votzi)/span_Stammdaten’))

WebUI.waitForElementVisible(findTestObject(‘Page_easyJOB EUD (Martin Votzi)/span_Lieferanten (1)’), 0, FailureHandling.STOP_ON_FAILURE)

WebUI.click(findTestObject(‘Page_easyJOB EUD (Martin Votzi)/span_Lieferanten (1)’))

WebUI.waitForElementVisible(findTestObject(‘Page_easyJOB EUD (Martin Votzi)/a_Lieferanten’), 0, FailureHandling.STOP_ON_FAILURE)

WebUI.click(findTestObject(‘Page_easyJOB EUD (Martin Votzi)/a_Lieferanten’))


and here is the log:
WebUI.callTestCase(findTestCase(‘ej login’), [:], FailureHandling.STOP_ON_FAILURE)

WebUI.delay(20)

WebUI.click(findTestObject(‘Page_easyJOB EUD (Martin Votzi)/span_Stammdaten’))

WebUI.waitForElementVisible(findTestObject(‘Page_easyJOB EUD (Martin Votzi)/span_Lieferanten (1)’), 0, FailureHandling.STOP_ON_FAILURE)

WebUI.click(findTestObject(‘Page_easyJOB EUD (Martin Votzi)/span_Lieferanten (1)’))

WebUI.waitForElementVisible(findTestObject(‘Page_easyJOB EUD (Martin Votzi)/a_Lieferanten’), 0, FailureHandling.STOP_ON_FAILURE)

WebUI.click(findTestObject(‘Page_easyJOB EUD (Martin Votzi)/a_Lieferanten’))

You havent shared the log? you just shared the script again

Sorry!

03-18-2019 01:53:16 PM click(findTestObject(“Page_easyJOB EUD (Martin Votzi)/a_Lieferanten”))

Elapsed time: 31,849s

click(findTestObject(“Page_easyJOB EUD (Martin Votzi)/a_Lieferanten”)) FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to click on object ‘Object Repository/Page_easyJOB EUD (Martin Votzi)/a_Lieferanten’
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:48)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:65)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:27)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:86)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:67)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$3.call(Unknown Source)
at lief Rabatt weitergeben.run(lief Rabatt weitergeben:28)
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:331)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:322)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:301)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:293)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:227)
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 TempTestCase1552913511072.run(TempTestCase1552913511072.groovy:21)

So weve made progress - the lines ive given you have passed but now we are failing at this point.

The element visible step is passing and the second is failing which is strange, after the element visible line could you try adding a delay of 5 seconds.

Coluld you also take a look at the elements attributes - are you searching for the element using xpath or attributes ? Could you please send through a screenshot of the elements attributes.

ElementVisible passes with a warning:

Unable to find the element located by ‘By.xpath: id(“menuToolbar_Menu_Stammdaten_subMenuLieferanten_ctl00_entryStammLieferanten_entryLb”)[count(. | //a[@onclick = concat(‘return !MSV_CheckIsWindowOpen(’ , "’" , ‘3_Lieferanten_aspx_ipz1umprh3a42awvftlx5ss3’ , “’” , ‘);’) and @id = ‘menuToolbar_Menu_Stammdaten_subMenuLieferanten_ctl00_entryStammLieferanten_entryLb’ and @href = concat(‘javascript:__doPostBack(’ , “’” , ‘menuToolbar$Menu_Stammdaten$subMenuLieferanten$ctl00$entryStammLieferanten$entryLb’ , “’” , ‘,’ , “’” , ‘’ , “’” , ‘)’) and (text() = ‘Lieferanten’ or . = ‘Lieferanten’)]) = count(//a[@onclick = concat(‘return !MSV_CheckIsWindowOpen(’ , “’” , ‘3_Lieferanten_aspx_ipz1umprh3a42awvftlx5ss3’ , “’” , ‘);’) and @id = ‘menuToolbar_Menu_Stammdaten_subMenuLieferanten_ctl00_entryStammLieferanten_entryLb’ and @href = concat(‘javascript:__doPostBack(’ , “’” , ‘menuToolbar$Menu_Stammdaten$subMenuLieferanten$ctl00$entryStammLieferanten$entryLb’ , “’” , ‘,’ , “’” , ‘’ , “’” , ‘)’) and (text() = ‘Lieferanten’ or . = ‘Lieferanten’)])]’. Please recheck the objects properties to make sure the desired element is located.

Ok so this is why the next step is failing

Can you try with it just detecting using tag and text and let me know what the result it.

1 Like

I had to add the id as tag and text are ambigous.
NOW IT WORKS! THX for that.

1 Like

Glad you got it working - could you mark my awnser as solution so others that come across this thread can find the awnser

1 Like

what does that mean? i am currently running into the same issue. I have spent 0.5 day on this.
What did you do to solve your issue? THanks