Not able to select list item in a drop down field by text

In my application, I am not not able to select a particular list item by text value.

WebUI.scrollToElement(‘Object Repository/Page_NewTitle/li_Raheja Geeta’, 3)

In the above statement, instead of selecting mentioned name, different value gets selected.

scrollToElement() does not perform selections.

Would you like to share the rest of your code along with an explanation of what you’re trying to achieve?

/Call Login Test Case
WebUI.callTestCase(findTestCase(‘ONIX_SB/0001_Login’), [(‘AppURL’) : ‘a’], FailureHandling.STOP_ON_FAILURE)

//Mouse hover Proposals menu
WebUI.mouseOver(findTestObject(‘Object Repository/Page_Product Admin/span_Proposals’))

//Click on Propose a Title link‘Object Repository/Page_Product Admin/span_Propose a Title’))

//Click on Create a New Title link‘Object Repository/Page_Propose a Title/a_Create a New Title’))

//Date date = new Date();

//Enter Title

WebUI.setText(findTestObject(‘Page_NewTitle/input_Title’), findTestData(“TestData”).getValue(“Title”,1))

//Enter Short Title
WebUI.setText(findTestObject(‘Page_NewTitle/input_Short_Title’), findTestData(“TestData”).getValue(“ShortTitle”,1))

//Select Authored‘Page_NewTitle/input_AuthoredEdited’))

// Select Publisher‘Page_NewTitle/input_Publisher’))‘Page_NewTitle/li_SAGE Publications Ltd’))

//Select Signing Editor

AcqEditor = findTestData(“TestData”).getValue(“AcqEd”, 1)‘Object Repository/Page_NewTitle/input_Editor’))‘Object Repository/Page_NewTitle/div_AcqEd’))
WebUI.scrollToElement(‘Object Repository/Page_NewTitle/li_Raheja Geeta’, 3)
//‘Object Repository/Page_NewTitle/div_AcqEd’))
//String ulSelector = findTestObject(‘Object Repository/Page_NewTitle/div_AcqEd’).findPropertyValue(‘xpath’)
//String liSelector = ulSelector + findTestObject(‘Object Repository/Page_NewTitle/li_AutomationQA’).findPropertyValue(‘xpath’)


//Select Target Pub Dt‘Page_NewTitle/input__EstPubMonth’))
WebUI.scrollToElement(findTestObject(‘Page_NewTitle/li_05’), 5)‘Page_NewTitle/li_05’))‘Page_NewTitle/input_EstPubYear’))

//Click on Add button‘Page_NewTitle/btn_Save’))

In the above code in following step, where I am trying to
//Select Signing Editor

Its a list of drop down, and I need to select specific value which I can in fact select from test data sheet
but here selectby is not working and the values are identified as list values, I am not sure how to resolve this, as I have lot many dropdown fields like this in my application

So finding a good solution is important.

I think (I’m guessing) the list elements are stored in the td-element below the input-element you highlighted. Can you open that td and send a screenshot? If they are not in that td, they must be stored somewhere else. You need to find them so we can see them.

In your code, what you need to do is click the dropdown element. Then I would try focusing the target list element and/or clicking it. But we’re not there yet… get me the screenshot so I can see what’s going on.

Thanks Thomas…
This is the screenshot when I clicked on a list element, its getting s

The full expath for the Editor dropdown:

The selector value found:

The Xpath

On changing any value in dropdown, the xpath is not getting changed, though i can find the li value for each separately

value displayed in Katalon xpath selector:

No, I expected a capture of the the elements in the dropdown.

which tells me the HTML is a <ul> element containing a bunch of <li> elements. Please take a screenshot of those elements.

is there any other way to connect for quick resolution, I need to complete this script today please

No there isn’t another way. The speed of resolution is unfortunately down to two things:

  1. The accuracy of your responses to my questions.
  2. The time I have available to help you. >90% of us are doing this for free while we are trying to do our own work.

So, please be patient.

The problem here is exacerbated by your lack of knowledge of the makeup of your page. For example, this input control is HIDDEN - notice the type="hidden" attribute:

Twice you have posted screenshots of that element when in fact it is of no interest, as far as i can tell. But since you highlighted it, I spent valuable time trying to figure out how it could possibly be involved.

So, based on what I see from your last post, I think you want to click on this element:

Then click on the <li> / list item you require. If that involves scrolling, it might be better to use keys instead of clicks. But first you need to get that dropdown to appear.

Word of advice: You obviously know how to open DevTools since you’re using it to capture screenshots. Now you need to learn how to find what’s relevant by tracking the HTML in the DOM and highlighting the correct elements. Highlighting the wrong element doesn’t help. Drawing red boxes around the wrong element doesn’t help. Please, learn to use DevTools properly. Then perhaps you would find a solution much quicker.

hey I asked the different way to connect because I was of the same impression that I am not able to explain the problem correctly in technical terms, and I was having the same idea that I might be increasing the time to get the problem solved and eating your time as well.

I am a manual tester, and just trying to learn Katalon by direct hands on as per the current project demand without any training.
I am not able to find any post or tutorial on handling li elements
Could you please help on how use keys to scroll instead of click and if you can direct me to the relevant post/video.


@ThanhTo Can you help here? I need to hit the sack and get some sleep…

1 Like

I’ve read the conversation and still are unsure of the exact element you’re trying to click on. From what I can understand, you want to click (select, but I think a click would suffice in this case) on a list item with different text depending on the requirement.

The following is a generic tutorial, aiming to help you to click on an element when you know that element contains a text, and that this text needs to be changed per requirement

First, in your script where you need to do click on the list item, write the following line:

// Text of the item that you want to click on
def textOfThisItem = 'katalon'
// Notice findTestObject is taking two things: ID of the test object, and a map containing the text you want to click on'Object Repository/item_has_text_that_needs_to_be_clicked_on', ['textVariable': textOfThisItem]))

At this point, the Test Object does not exist yet, which is why you need to manually create a blank Test Object called item_has_text_that_needs_to_be_clicked_on right under Repository folder.

If you notice in the above code, the findTestObject is accepting the second argument which at this point does not make sense yet. However, intuition should tell you that the passed in value will be used somehow.

The next thing you need to do is to specify the following XPath into the newly created Test Object.

Pay attention to $ since it is a must. The locator itself doesn’t make sense, because ${textVariable} is not a valid XPath syntax. However when this Test Object is used in execution, Katalon will replace ${textVariable} with the value passed in the second argument of findTestObject.

Both ${textVariable} and the value which will actually be used katalon are present in the code above, I believe your intuition would help connect the ideas.

When the line of code above is executed, the final locator would be:

//*[contains(text(), 'katalon)]

which selects an element that contains the text “katalon”. Then this element will be clicked on by

To confirm this, you can write this after the above piece of code:

println findTestObject('Object Repository/item_has_text_that_needs_to_be_clicked_on, 
['textVariable': textOfThisItem]).getSelectorCollection()

(Ctrl + Shift + O for auto imports)

which will print //*[contains(text(), 'katalon')] to the console log. I include this because you may want to trial and error the XPath to your element, for which printing our the XPath will be helpful. You can compare the expected XPath against what is printed to see if it maches your expectation.


The practice of using $ in your Test Object is called Test Object Parameterization (parameterization means you use variables instead of hard-coded values). Documentation here (Mobile in the title is irrelevant, it is also applicable to Web):

Thanks a lot, I will try