1
votes

I have a problem with test payment gateway pop-up handling with this HTML code:

<div class=""> 
<div class="legend">Select payment method</div> 
<div id="payment-options" class="grid clear count-3"> 
    <div class="payment-option item" tab="card"> </div>
    <div class="payment-option item" tab="netbanking">
        <label>
            <i></i>
            Netbanking
        </label>
    </div>   
</div>  
<div class="clear"></div>

I am using XPath: //*[@id='payment-options']/div[2]/label. I have to click image link but every time I'm getting an error as Unable to locate . Can anyone help me here?

1
Please share website and then edit it again once work done..Kishan Patel
@Saurabh, There is no div[2] under *[@id='payment-options']/ tag, in the HTML code you shared. There is only one div tag. Can you please let me know which element you want to clickk.s. Karthik
@Karthik: My mistake, forgot to add the first div.Saurabh

1 Answers

0
votes

from the html snippet you shared, i dont see the id='payment-options' can you try using cssSelector instead?

By.cssSelector("div.option.item");