Outsystems Drop down menus and Katalon's command Option By Value

Hello there Katalon community! So me and my co-workers are having a bit of an issue with the command Select Optin By Value on Outsystems code… We can make the tests with commands Click and Set Text, but since selecting the option itself by value is much more efficient and a better practice (because we know we will always get the result we intended to), we are aiming to resolve this problem and make our tests better!
Bellow I’m going to show you guys just a sample of the test but it’s basically the same error in every other drop down menu we capture on the site. We can in fact catch the objects, we even went to the inspect elements and made sure we were actually catching the select object were all the values are stored.

Sample_test_Select_Option_by_Value

The craziest thing is that of all the drop down menus, one actually works perfectly, but the other ones just give us the error :

And even crazier it’s the fact that, as i said before, we had one drop menu working perfectly so we decided to save it there and keep working on the problem the next day, but somehow, we saved it when it was working and now it doens’t work either … i feel like either Katalon or the Outsystems code is flipping us :rofl: :sob:

The image bellow is the drop down menus i am talking about:

The XPaths on the drop down menus/select objects are as follows (we tried the one that spy web gave us and the one that inspect elements on the browser gave us)

spy web XPath for object ‘Drop_menu_Car_Value’:

inspect elemnts XPath for object ‘Drop_menu_Car_Value’:

So as i see it, the error is…* :

com.kms.katalon.core.exception.StepFailedException: Unable to select option by value ‘4132834’ of object ‘Object Repository/Codan_Car_OR/Codan_dk_Car/Drop_down_menus/Drop_menu_Car_value’

*…implying that he can’t access the value I’m asking of said select object. But it has already worked on one of them (did and now does not…?) and we did the same exact steps to the other selects when the first one was still working fine and we got this same mistake. We have double and tripled checked the xpath through the inspect elemnts but to no avail… I hope i put enough info here so you can make some sense of this, if not please tell me what you need to understand the problem we’re having. Anyway, thank you guys for this community it’s my second time posting but i have solved some problems before by seeing your answers on other posts, so keep up the great work pls! Katalonians appreciate your service :clap:

Plenty of info, thanks.

It sounds to me as if there’s a sync issue. Are waiting for the elements to be finished populating and be visible?

Hi there @Russ_Thomas, thanks for the quick reply! We already tried that but it seems that’s not the issue. In any case i will try it again to make sure. But the thing is, the values are supposedly already in the select/drop down menu when the page has been fully loaded, for example in our case where that one drop menu worked with the command Select Option By Value we didn’t had to ask for it to wait for them to be visible. But i will try that again.

There is another possibility but based on your screenshots, I think it unlikely. It’s possible the select is not the element that’s used in the UI. The reason I’m suspicious is how they look on the page – selects are not easy to style. Yet, it seems from your screenshot, they are the visible elements (which I found surprising).

Double check to be sure. In the webpage, right-click on the select element as it is presented, and choose “Inspect” from the menu. Does that take you to the <select> element, or something else?

Well, that’s the thing it does not, it leads me to this span in the image, that’s why we had to capture the XPath through the Inspect Elements.

ah, now you’re getting somewhere. THAT is the element a real human user is interacting with. You need to automate that, if you can. This also means selectOptionByX will not help you.

Why did it work before? Because those elements exist but they’re probably hidden and “pretty” elements are used as proxies for them.

Yes i get that, thats’s what we are actually clicking, but somehow it worked yesterday and so i assumed it would also work for the other drop down menus. Damn it, so it would only work if we were directly interacted with it is that it? Yes we have done the test using other commands like click and set text, just super frustrating that it actually worked on 1 and not the rest :sob:

I wil try to recreate the test to work with the Select byOption by Value and send you the screenshots, maye you can figure it out, hopefully. Just give me a few minutes I’ll send it.

I advise you not to do that. It’s likely a waste of your time.

Ahahah it sure felt like it …ok then. Well so basically in order for those commands to work properly, or even at all, we need to be interacting with the obect directly, did i get that right?

1 Like

Also, looking at your code, I don’t see you waiting for anything to be visible. You are going to see issues if you don’t wait.

Your test should be structured like this:

  1. Do all your waits for everything you are likely to interact with.

  2. Perform actions

#2 may involve more waits if they cause communication with a server.

the spans, yes, not the select/options.

I think i did it as you told me to but I’m not sure. Is this it, or the select option by value is impossible with the span?

I just noticed i dind’t put a time out, will try again sorry.

That is true

Fudge. Ok then, thanks for the help @Russ_Thomas. So just quick last question (for now at least :rofl: ) i could have done it with the command select by value if the select was the actual object we were dealing with correct? But since it’s “masked” with a span it’s not possible.

1 Like

It seems @Russ_Thomas has you in hand, but I wanted to find out something for myself. I would think that the Select element has the list of items (values), and the Span has the display of the chosen item.
Can you try something since I noticed you are using Chrome? When you Inspect the Element, like you do in the first image above, can you click in the Code window and hit CRTL + F. This will bring up the Find window below the code. In that window, type (or paste) the XPath you have for the Element and see if the Select highlights (in yellow) and a “1 of 1” displays to the right of the XPath. Also, have you tried the XPath format:

id(“wt2_DTM…”)

note this format only works for ID and they are parenthesis surrounding the quotes, not square brackets. Copy and paste the ID from the code window (double click the ID reference). You should get the Select element highlighted and the reference, 1 of 1, to the right. If it says something other than that (or nothing at all), then the XPath is not correct, like a missing parenthesis, quote or spelling. If it says something like, “1 of 2”, then the XPath is not unique and you have to work on that.

Also, have you used verifyOptionPresentByValue() to check if that works and the selection is different to the verification? Again, just curious. If the verification works, then I think you have a wait-time issue–maybe you need a waitForElementClickable() or @Russ_Thomas has a suggestion.

2 Likes

Hi there thank you for taking the time to look into this issue. Yes @Russ_Thomas has been very helpful, but i did try what you’ve asked and it does find the select i intend to. I’ll send the picture down bellow showing the ways of getting the object. Also i have tried verifyOptionPresentByValue() and waitForElementClickable() but hey don’t seem to work…

If you bring your mouse over the yellow highlighted element in the CODE window, does the associated element on the WEB page highlight in blue. If not, move up or down the code window to see where the associated element is that does make the web element highlight in blue, like maybe one of the Span elements. Or elsewhere?? You may have to create a test object that is the associated element such as a Span element.
Also, have you searched the web page source (View Page Source) for the text of the drop-down you have selected?

Thank you for taking the time to reply. I was able to fix the problem fortunatly by creating a kind of dynamic custom keyword that would give me the correct XPath to use the drop down menus. It works like wonders now, but thank you!