tags:

views:

276

answers:

1

I have a html table like:

<table ..... class="cars">

<tr class="item-odd">
...
</tr>
<tr class="item-even">
</tr>

</table>

How could I get the table rows using xpath?

//tr[contains(@class, ???)

can I use OR in there somehow to say item-odd|item-even

+5  A: 

You can get the rows like this:

//table[@class='cars']/tr

To get the item-odd rows, you would do this:

//table[@class='cars']/tr[@class='item-odd']

Yes, you can use or, e.g.:

//table[@class='cars']/tr[@class='item-odd' or @class='item-even']

See http://www.w3.org/TR/xpath for more details.

Malcolm Sparks