c# - Unable to locate button that has no ID; Button has a hidden attribute value -


i using c# selenium web driver. issue unable locate start button has no id value.

the unique identifier have found object 'value="74"' text.

html button follows:

<div class="product-item-inner">   <div class="product">      <h3>cyber liability</h3>      <p class="carrier-about">lloyd's, london - best "a" (excellent)</p>   </div>  <form action="/index.php?c=pcs.integrate" method="post">     <input value="74" name="product_id" type="hidden">     <input value="" name="insured_id" type="hidden">     <input value="" name="contract_class_id" type="hidden">     <a href="#" class="product-information">product information</a>      <a class="tile-button start" href="#">start</a>  </form>  </div> 

i able perform record , playback using firefox ide (see line below) need way consistently locate button object using unique identifier.

driver.findelement(by.xpath("(//a[contains(text(),'start')])[16]")).click();

i have tried following not working:

driver.findelement(by.xpath("(//input[@name='product_id'][@value='74'])")).click();

thanks in advance

for clicking on 'start' button respect text 'cyber liability' above, can try below xpath:

//h3[.='cyber liability']/ancestor::div[@class='product-item-inner']//a[.='start'] 

this locate a element innerhtml/text start descendant node of div element class attribute product-item-inner ancestor of h3 element innerhtml/text cyber liability.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -