Issues with drop-down selection


#1

Hi, Im new to this whole automated testing stuff so bare with,

I am trying to select an address that has been looked up from a post code (zipcode) the search returns the properties that share this post code, this bit works fine but when the script tries to select any of the listed properties it throws this error:

Test Cases/chrome permit on new address FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to click on object 'Object Repository/[REDACTED]/a_98 STERNHOLD AVENUE LONDON SW2 4PP'

This is the script for the part i am running with my Object’s Repository Redacted due to it containing client specific information

//search
WebUI.setText(findTestObject('Object Repository/[REDACTED]/input_Search Postcode_postcode'), 'sw24pp')

WebUI.click(findTestObject('Object Repository[REDACTED]/i_Search Postcode_fa fa-search'))

WebUI.delay(0.5)

//selecting from the drop down
WebUI.click(findTestObject('Object Repository/[REDACTED]/a_98 STERNHOLD AVENUE LONDON SW2 4PP'))

WebUI.selectOptionByValue(findTestObject('Object Repository/[REDACTED]/select_98 STERNHOLD AVENUE LONDON SW2 4PP10_cba0a2'), '98 STERNHOLD AVENUE, LONDON, SW2 4PP', true)

Thanks in advance

edit: The annoying thing is, is that I have an as far as i can tell identical script working on another address, would it be feasible to be a object repository issue?


#2

Hi, I’m very, very old, pleased to meet you :slight_smile:

First read this and follow any pertinent advice (I’d like to see your errors, for example, and anything else you think might help me)

Doubtful. The forum would be full of bug reports. It’s more likely a timing/sync issue in your code (or a typo?)

Pst some of that info back and we’ll take a look.


#3

Thanks russ and sorry for the delay,

Preformatted text2019-11-11 08:37:27.938 ERROR c.k.k.core.keyword.internal.KeywordMain - :x: Unable to click on object ‘Object Repository/[REDACTED]/a_98 STERNHOLD AVENUE LONDON SW2 4PP’ (Root cause: com.kms.katalon.core.exception.StepFailedException: Unable to click on object ‘Object Repository/[REDACTED]/a_98 STERNHOLD AVENUE LONDON SW2 4PP’
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.ClickKeyword.click(ClickKeyword.groovy:79)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:42)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:60)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$1.call(Unknown Source)
at chrome permit on new address.run(chrome permit on new address:76)
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 TempTestCase1573461368677.run(TempTestCase1573461368677.groovy:23)
Caused by: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/[REDACTED]/a_98 STERNHOLD AVENUE LONDON SW2 4PP’ located by ‘By.xpath: //a[@id=‘bs-select-7-0’]’ not found
at com.kms.katalon.core.webui.common.WebUiCommonHelper.findWebElement(WebUiCommonHelper.java:1113)
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.ClickKeyword$_click_closure1.doCall(ClickKeyword.groovy:52)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.call(ClickKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:79)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:42)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:60)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$1.call(Unknown Source)
at Script1573033153327.run(Script1573033153327.groovy:76)
… 11 more
)
2019-11-11 08:37:27.942 ERROR c.k.katalon.core.main.TestCaseExecutor - :x: Test Cases/chrome permit on new address FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to click on object ‘Object Repository/[REDACTED]/a_98 STERNHOLD AVENUE LONDON SW2 4PP’
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.ClickKeyword.click(ClickKeyword.groovy:79)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:42)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:60)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$1.call(Unknown Source)
at chrome permit on new address.run(chrome permit on new address:76)
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 TempTestCase1573461368677.run(TempTestCase1573461368677.groovy:23)
Caused by: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/[REDACTED]/a_98 STERNHOLD AVENUE LONDON SW2 4PP’ located by ‘By.xpath: //a[@id=‘bs-select-7-0’]’ not found
at com.kms.katalon.core.webui.common.WebUiCommonHelper.findWebElement(WebUiCommonHelper.java:1113)
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.ClickKeyword$_click_closure1.doCall(ClickKeyword.groovy:52)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.call(ClickKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
… 17 more
This is the entire failure in the console, I don’t know which points are relevant.

And this is the html with the drop-down in question.

thanks


#4

This is the reason why Katalon is unable to click: because the locator of your test object is not correct. Can you try the locator: //a[@id=‘bs-select-2-0’] instead. (type it in rather than copying and paste, since in that case you may copy weird invisible characters)


#5

Thanks, that works is there an explanation as to why the recorder made it a 7 and not a 2?


#6

@stan.sole

Probably because at the time you recorded it was 7, and now it’s 2. Do you have any stable information about the object you’re trying to click, because the ordering (encoded in the ID) is probably the least stable thing. Is there any expected text that you can use in your locator ?


#7

That’s very odd because I’ve had a consistent error with all of the addresses that I’ve tried that are 7 and no issues as to the ones that are 2 I’m not sure its the html that is broke, because its consistent I just had no idea as to what it could be

Well not really since its based upon a lookup, so when the drop down is generated there could be a different set of results if i used say a different post code.


#8

The only thing that seems consistent with the failures is recording in chrome vs firefox


#9

It may suggest the site behaves differently in these browsers, but before we can say that with certainty, I’d still suggest you try to see if the locator is consistent across multiple record-playback sessions.


#10

The locator records 2 in firefox but in chrome it records 7 consistently however 2 works in both and 7 never works in either on playback, and its only an issue with that dropdown too, it has never been an issue with a title dropdown or a date dropdown so I don’t know