jeudi 20 août 2020

getting error not able to locate the element [duplicate]

HTML code:

<button type="button" class="new-method svelte-13rsokc" role="listitem" method="card">
<div class="stack svelte-12i0eli horizontal"><i slot="icon" class="svelte-ly2ugt"> <svg viewBox="0 0 27 22" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <path d="M2 7v13h18v-5H7V7H2zm0-2h5v10h15v5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2z" fill="rgba(0, 205, 205, 1)"></path>
    <path d="M10.004 13.003a1 1 0 0 1 0-2h2a1 1 0 0 1 0 2h-2zM7 0h18a2 2 0 0 1 2 2v13a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2zm0 2v13h18V2H7zm-.282 5.005a1 1 0 1 1 0-2h19a1 1 0 0 1 0 2h-19z" fill="rgba(0, 102, 102, 1)"></path>
  </svg></i> 
<div class="svelte-13rsokc"><div slot="title" class="svelte-ly2ugt">Card</div> <div slot="subtitle" class="svelte-ly2ugt">Visa, MasterCard, RuPay &amp; More</div></div> </div></button>

There are many options of payment in that I have to click on card option the above HTML code is for card .i am not able to click on card option by using XPath,CSS.

This is my selenium code:

WebElement tc1 = driver.findElement(By.xpath("//*[@id=\"form-common\"]/div[1]/div/div/div/div/div/button[2]"));
tc1.click();

please help me out.




Aucun commentaire:

Enregistrer un commentaire