4

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?

danalif
  • 117
  • 1
  • 8
  • 1
    You can not find element using `cssSelector` with visible text here..try using `xpath` as `//select[@id='cbo_Subcategory']/option[text()='Badge']`... – Saurabh Gaur Jul 14 '16 at 11:15

1 Answers1

5

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..:)

selva
  • 1,175
  • 1
  • 19
  • 39
Saurabh Gaur
  • 23,507
  • 10
  • 54
  • 73