I am using Selenium for the first time and am overwhelmed by the options. I am using the IDE in Firefox.
When my page loads, it subsequently fetches values via an JSONP request, with which it populates options in a select.
How do I get Selenium to wait for a certain option in the select to be present before proceeding?
I think you should be use
waitForElementPresent
command. If possible let's me see your selenium IDE code.Using java 8
Awaitility
Its work for me:
I used
waitForElementPresent
with a css target.Example: To wait for
to be populated with
use
waitForElementPresent
css=#myselect option[value=123]
I made the following function in C# that returns the select when is populated.
You have to pass a By to find the element and you a specific time to wait for it to be filled:
In my case I validate tha the select has more than 2 options, you can change the code so that it validates the quantity that fits your needs.
We had similar problem where the options within drop down was fetched from a third party service, which sometimes was a slower operation.
here is the definition for waitUnitlSelectOptionsPopulated
Note: A check of select.getOptions().size() >1 was needed in our case as we had one static option always displayed.