danalif
danalif

Reputation: 117

Selenium IDE - How to wait for options by name in a select to be populated?

I am working with Selenium IDE and on my webapp I have a select of the type:

<option value="34">Badge</option>
<option value="38">Bodywork</option>
<option value="1">Category 1</option>
<option value="36">Window</option>

I need to wait for an option to be populated in the select using name/text option (e.g.: 'Badge') instead of value/id (e.g.: '34'), before proceeding.

My idea is to use waitForElementPresent function, but for test I used assertElementPresent when options were already populated.

I have tried this:

assertElementPresent
css=select[id='cbo_Subcategory'] option[name='Badge']

and this

(...) option[text='Badge']
(...) option[label='Badge']
(...) option[name=Badge]
(...) option[text=Badge]
(...) option[label=Badge]

but it did not work. Any ideas?

Upvotes: 4

Views: 774

Answers (1)

Saurabh Gaur
Saurabh Gaur

Reputation: 23815

If it's not mandatory then you can use css, only then you can try using xpath as below :-

//select[@id='cbo_Subcategory']/option[text()='Badge']

Hope it works..:)

Upvotes: 5

Related Questions