tags:

views:

34

answers:

2
+2  Q: 

Question on xpath

Following Question:

<div id="id-74385" class="guest clearfix" style="z-index: 999;">

Given above,

If I want a xpath with checks both id and class, can we do it w/ 'and' condition LIKE:

//div[@id='id-74385'] and div[@class='guest clearfix']

Is this correct way? My execution fails here... Please help!

+4  A: 
//div[@id='..' and @class='...]

should do the trick. That's selecting the div operators that have both attributes of the required value.

It's worth using one of the online XPath testbeds to try stuff out.

Brian Agnew
+3  A: 

or //div[@id='id-74385'][@class='guest clearfix']

+1 didn't know you could do that
Brian Agnew