lundi 27 juillet 2015

Click element by Value - protractor

I am clicking to modal window which is pretty simple. In general only relevant part is this:

<div id="partSelection">
   <button value="0" name="partSelection">BLATNÍK P L</button>
   <button value="1" name="partSelection">BLATNÍK P P</button>

I need to click one of this button, I know how to click this with: xpath:

element(by.xpath('//*[@id="partSelection"]/button[2]')).click();

also way with button text:

element(by.buttonText("BLATNÍK P P")).click();

but I noticed there as different values for each button and I belieave this is something which is not going to change by developers. Is there a way how to click element base on value?

Thank you for your advises.

Aucun commentaire:

Enregistrer un commentaire