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

Hallo #TeamKatalon #Community,

I want to select a option from this drop-down box;

  <div class="col sizeL">
        
    <label for="chargingPoint.chargingPointType" class="text">
      Charging Point Type<span
        class="hide">()</span>*
    </label>
<option value="">--- Please select ---</option>

<option value="174002">11kW (STANDARD)</option><option value="173028">22kW (STANDARD)</option><option value="174001">3.7kW (STANDARD)</option>
</div>
<div class="formRow">

But I dont know what should I put to the Command & Target & Value section to select the option for example : 11kW (STANDARD)

thanks.

hi,
check this

hi,

are you able to show address (.html) or is it security issue?

Is this value dynamic?
value=“174002”

hi,

not sure, try to dig CSS selector as locator

hi,

select inspect element --> element is highlighted --> right click --> copy -> css selector
paste it as locator in your recorder, i guess it’s a target value
Not used so much Katalon Recorder, sorry

hi,
yes there is css selector, paste it e.g. to notepad after you are copied it
inspect element when dropdown item is selected

paste in Recorder here
image

hi,

try to use
click not select

hello,

hard to say now what is issue, need to do more investigating, but now going to bed :slight_smile:
Can you try with selenium (python or java) or better with Katalon Studio?

hi,

I will suggest to you export your test from katalon Recorder as python webdriver and will start to use Selenium
https://www.guru99.com/selenium-python.html

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;