Selenium: How to wait for options in a select to b

2019-02-04 09:34发布

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?

8条回答
家丑人穷心不美
2楼-- · 2019-02-04 09:54

I found handy something like:

wait.until(
    ExpectedConditions
        .presenceOfNestedElementsLocatedBy(By.id(<selectioNId>), By.tagName("option"))
)
查看更多
够拽才男人
3楼-- · 2019-02-04 10:02

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

查看更多
登录 后发表回答