Select option from drop-down box by *katalon recorder*google chrome extension

Hi AryaMehr360

Please try:
image

or

image

Without running it myself, that should select the option :slight_smile: then all youd want to do is change the label value to your desired option.

Let me know how you get on and happy to replicate the HTML and run it locally if needed.

Was worth a try, that would work on a normal select dropdown.
Is this page public facing? would be so much easier, if its public facing could you share the URL?

No worries,
Can you share the HTML as a snippet to opose to a screenshot?
you could attempt to do it via script aswel as a work around.

post deleted

Hi,

So this works:

Command: Select
Target: xpath=(//*[@name=‘chargingPoint.chargingPointType’])
Value: label=22kW (STANDARD)

Could you try and let me know how you get on :), given some your assets are server side etc… arent at play with my local, so maybe that would impact it slightly? I will have a play around with the file though and try to get it rendering closer to how you have, just incase the above doesnt work

No unfortunately this one doesnt work.

Hiya

Could you try this:
Command: addscript
Target: $(‘select[name=“chargingPoint.chargingPointType”]’).val(‘111’).trigger(‘change’);

the val(‘value’) is the value of the item you’d like to select:
image

Hopfully this will work :slight_smile: basically you have a plugin that generates on page load (which we knew already), which makes it a little more tricky.

Hi
You won’t need the click before it, could you try it without that click (not that, that should impact it)
could change the “addScript” to “runScript”, both work in my instance.

If you go to your page and change the value of that dropdown from its default, and while katalon is open, right-click that command and select “Play This Command”

image

Does it change the value?
Thanks.

Can you run the script in console to oppose to katalon please:
$(‘select[name=“chargingPoint.chargingPointType”]’).val(‘106’).trigger(‘change’);

Does that change the value?
If not then it will be something minor that needs changing for the target for how your HTML is being loaded at best guess, as the provided HTML works for me in console and katalon.

Before:


After:

Hi

It’s the quotes, when copying it from the comments in the forums and then pasting it, is pasting the quotes in weird :cry:

Copy it from this file:
scriptTest.txt (82 Bytes)
Or you could type it out?

as if you see below, when copied and compared against typed, the quotes differ:

But this will probably be why katalon recorder isn’t working, due to how it’s being pasted

Yes good to find it out but still it not chenging;

Could you try this in console:

;(function($){
$(‘select[name=“chargingPoint.chargingPointType”]’).val(‘106’).trigger(‘change’);
})(jQuery);

In katalon, please make sure your using runScript too, if the above works in console for you.

With the $ var it could be either jquery just isnt loading or,the $ var and its not being released so it won’t collide with other libraries, again i dont know your set up… so its at best guess, but the above would confirm somewhat this.

Thanks

1 Like

Remember the quotations, cant copy it from here as it throws them in wrong :wink:

hi,

paste first to notepad and copy from there

1 Like

It will still throw them in wrong unfortunately (would love to know why copying from the comments does that though), but he’d best just pasting and changing them himself,
or take it from the file below :joy::
scriptTest.txt (114 Bytes)

1 Like

That’s fine :slight_smile: that’s expected.
Did it change the value in the dropdown?
If yes, then bang that in the runScript command in katalon and it should then work :+1:
Thanks

Yeeessssss, Finally, OK can you please tell me how should I exactly but this in the katalon recorder ;
I mean in the command target value.

Thank You a looooooot :smiley:

1 Like

Just put that function into the target as before :slight_smile:
as seen below:
image
Command: runScript
Target: ;(function($){ $(‘select[name=“chargingPoint.chargingPointType”]’).val(‘111’).trigger(‘change’); })(jQuery);

1 Like

Thank you very much it was realy helpful <3

1 Like

Your Welcome! :blush:

If you want any advice, I’d look into the basics of JQuery, Javascript and XPaths/CssSelectors, these will help you massively with the more complex HTML pages and how they render and features of webpages, and more so due to using this browser plugin.

Also, if you wanted to go one step further, you could extract that function and pass the parameter(s) and locator, which you could use an extension script, so that way you could reuse that function across your whole site.

All the best!
Don’t be afraid to drop me a message directly if you need a hand :slight_smile:

– Was a good little page you had here, a first for me with how it renders due to the plugins and i picked up a few little things here! – So Thank you!!

2 Likes