xpath to get rows inside a table

java, xpath

Solution

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.

Problem

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

Original source