selecting the search result in watir

Currently i need to search a text and select the expected result from the search list.Search result displays with li tag and the text resides under span tag. Searching text will be like this Phone,Phone-audio,Phone-video .My source code is displaying like below..Please help me to select either Phone-audio or Phone-video.

<ul>
<li class="Searchitem"></li>
<span value="AL">Phone</span>
<li class="Searchitem"></li>
<span value="AL">Phone</span>-audio
<li class="Searchitem"></li>
<span value="AL">Phone</span>-video
</ul>

Answers


That html doesn't make any sense, and definitely isn't per standard. Neither the span nor the -audio or -video are inside the li tags. I'm not even sure what element you need to click.

If it was html was compliant it would be as easy as: browser.span(text: 'Phone-video').when_present.click or maybe this would work, depending on the rest of the site's html, but it would be very flaky if anything changed: browser.ul.span(index: 1).when_present.click


Need Your Help

JAX-RS ajax issue

javascript jquery json html5 jax-rs

I'm trying to call a JAX-RS webservice with ajax using jquery

Auto-remove custom field with no value on publish

wordpress function duplicates custom-fields

I got some plugins that auto-generates custom fields. Does anyone know how to automatically remove empty custom fields from post when I press "publish"?