Find an option tag with 'selected' attribute with robot framework

Viewed 223

The application under text includes these option tags:

<option value="0" selected>Page 1</option>
<option value="1">Page 2</option>
<option value="2">Page 3</option>

etc.

Using Robot Framework, I would like to create a locator to find the option tag that contains or ends with "selected" So far I've not been able to get one to work.

XPath for the selected option above is:

//*[@id="sfpagingation-dropdown"]/option[1]

CSS for same selcted option is:

#sfpagingation-dropdown > option:nth-child(1)

Maybe it's not possible?

Thanks for any assistance.

1 Answers

Figured it out, or at least, I have something that seems to be working:

${SELECTED}=  xpath=//option[@selected=""] 

"Wait until page contains element" is also necessary

Related