xpath - Click an element based on attribute -



xpath - Click an element based on attribute -

i have code:

<div class="menufamille" idcat="1025"> <div class="menufamillebutton on ">item 1</div> </div> <div class="menufamille" idcat="1026"> <div class="menufamillebutton on ">item 2</div> </div>

i don't know how click on first div idcat="1025" in casperjs. should utilize xpath?

simply utilize attribute selector (css). there no need xpath expression, add together comparison:

class="lang-js prettyprint-override">casper.click(".menufamille[idcat='1025'] > .menufamillebutton");

or

class="lang-js prettyprint-override">casper.click(x("//*[contains(@class, 'menufamille') , @idcat='1025']/*[contains(@class, 'menufamillebutton')]"));

xpath click css-selectors casperjs

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -