Please help! I am new to automation.
I am trying to set the selected value of a dropdown. As per the source code, the dropdown is a button. I am able to click the button and display the dropdown list with below keyword
Click Button id:ha-select-target-31
How do I set the selected value to ‘Invoice No’ from the list. Please see screenshot of source and dropdown below.
NodeList(3) [ a, a, a ]
0: <a tabindex="-1" href="/en-US/docs/Learn" role="menuitem">
1: <a href="/en-US/docs/Learn">
2: <a href="/en-US/docs/Learn">
Assume the first of those elements is hidden for some reason. That would result in the error you mentioned.
You expected to find the element you saw (just the one), but since multiple elements were found (and you did not expect those), that can result in this scenario.
Check that your selector matches only the element you want.
If not, try to modify the selector so it matches only the element you want.
Yes. I got the same issue with GLPI Drop down menu that load the content of the dropdown menu via an Ajax request.
Didn’t solve it yet…
To know if that’s the case, you can use the inspector of your browser and check the Network tab to see if there is any Ajax request made when you click on the dropdown button.