Selenium: How to wait for options in a select to be populated? Selenium: How to wait for options in a select to be populated? selenium selenium

Selenium: How to wait for options in a select to be populated?


I used waitForElementPresent with a css target.

Example: To wait for

<select id="myselect"></select>

to be populated with

<option value="123">One-two-three</option>

use

  • Command: waitForElementPresent
  • Target: css=#myselect option[value=123]
  • Value: (leave it empty)


I found handy something like:

wait.until(    ExpectedConditions        .presenceOfNestedElementsLocatedBy(By.id(<selectioNId>), By.tagName("option")))


You can use "WaitForSelectOption" command where your value can be direct labellike label=1-saving Account target will have the object id