cancel
Showing results for 
Search instead for 
Did you mean: 

How to use 'Invoke Javascript Function' to fire

sumire
Level 8

Hello,

There is a web page that fires an event when user select the pull-down menu(combo box).

e.q.

<body>
<select>
    <option>apple</option>
    <option>orange</option>
    <option>banana</option>
</select>
 
<script>
    $('select').change(function() {
        var text = $('option:selected').text();
    
        console.log( text );
    });
</script>
</body>

If I select this pull-down menu with "Select Item" , the event doesn't fire.
So I thought that I could fire the event by using the "Invoke JavaScript Function", but I don't know how to use.
Can someone please tell me how to use "Invoke JavaScript Function"?
Or is there other more appropriate technique?

Thanks in advance.

------------------------------
Mitsuko
Asia/Tokyo
------------------------------
------------------------------
Mitsuko
Asia/Tokyo
------------------------------
2 REPLIES 2

EmersonF
MVP
Hello, I hope you are well, then you can use the dynamic element and force the click.

I usually only use JS in extreme cases, I think the support team may have problems.

Try to map the first element and place it as dynamic, if you have to select other options, you can do this by XPATH or even by value

------------------------------
Emerson Ferreira
Sr Business Analyst
Avanade Brasil
+55 (081) 98886-9544
If my answer helped you? Mark as useful!
------------------------------
Sr Cons at Avanade Brazil

bruce.liu
Staff
Staff
Hi Mitsuko,

Try spy the element using UIA mode. It seems to work in my instance.

------------------------------
Bruce Liu
Senior Product Consultant, Professional Services
Blue Prism
Australia/Sydney
------------------------------