CodeLover CodeLover - 1 year ago 63
Ruby Question

How to use "selenium-webdriver-xpath" to get the text value from <td>?

Find the below


<table id="supplier_list_data" cellspacing="1" cellpadding="0" class="data">
<tr class="rowLight">
<td class="extraWidthSmall">
<a href="/aems/do.list"> Cdata </a>
<td class="extraWidthSmall">
<a href="/aem/do.list"> xyz </a>
<td class="extraWidthSmall">
<a href="/bem/do.list"> ppm </a>

Now using
how to get the value
(means always the second
) . Give me an idea please!

Answer Source

Try //tr/td[2]/data().

//tr/td selects all <td/> elements, [2] the second result inside each <tr/> and data() returns their contents.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download