How to select in dropdown

How can I select a option in a dropdown/combobox/select?

I tried this and it didn’t work:

Then I tried with xpath expressions like this:
and it didn’t work:

This is the select:

Can you help me please?

Just a note that in your HTML the label, Cedula, has a space after it. You will need to either add a space to your comparison, like "Cedula " or use Regular Expression, such as "Cedula\\s" but you have to set boolean to true.

Or you could use, value=1 instead of label='Cedula '.


I used value=1

But I don´t know if it works, because it doesn’t reflect it in the html

How can I use the regular expression that you told me?

According to the below website, you can add regexp: in front of your text to support regular expression. So you can try either:
label=regexp:Cedula\\s or label=regexp:Cedula.*|%20Regular%20Expressions-,Selenium%20Testing%20|%20Regular%20Expressions,of%20patterns%20that%20Selenese%20supports.&text=In%20Selenese%2C%20regular%20expression%20patterns,would%20be%20very%20difficult%20otherwise.

1 Like

I used value="1" and I have this error:

And used label='regexp:Cedula\\s' or label='regexp:Cedula.*'

The error is the same with both options

For matching the text Cedula, you will have to use your e with the accute (or is it grav) sign over it.

Did you get an error message with the format, value=1?

I don’t know if the answer it is in the HTML

I tried with the accute and is the same error.

Yes I did it with the format value=1 and I have error

Sorry. Try without the quotes: label=regexp:Cedula.*

This time it worked but it is not reflected in the select the option that I select:

I will explain you the flow of the app.

When I Select in the dropdown “Cédula”, then I type the ID. Then of this step y press enter and the app get the info of the client and autocomplete the inputs whit ajax:

But I can’t see the inputs autocompleted. I don’t know if katalon recognize this step and can show it

I assume you had to manually put the information in the image. Can you go the following web site to test the RegExpression?

Double click on the Cédula in the HTML code and copy the text and paste it in the lower Test String window (remove everything that is already there). Next copy the value from your KR code window and paste it in the upper Regular Expression window (remove everything that is already there). Do you get a full match? I am just wondering if something about the é was causing conflict with RegExp.

should I copy it like this?

Remove all the additional text except, Cédula and the space that is at the end. Also keep the .* that is at the end of the Regular Expression. Does "Cédula " in the HTML match the word we have in Recorder?

it works

In KR it works, but I can see the option selected in the dropdown when I play de record

I assume you meant to say that in KR is doesn’t work (doesn’t select the option Cédula). You have tried value=1 and label=regexp:Cédula.*. Can you try: index=1

I tried index=1 and doesn’t select the option “Cédula”. When I analize the html I saw the elements that interact when I click on the option “Cédula” and are these (mark with rose highlighter):

I do not know if this has influence on the errors

What is the xpath you are using again? Is it id("tipoIdentificacion") for the select (or //select[@id="tipoIdentificacion"] is also valid)?

I used both and the error is the same

I think we need more assistance perhaps from @ThanhTo or @Mark_Gibson.

1 Like