1
votes

I am trying to use xpath to find input in a textbox a card number but the id is dynamic and class contains multiple hyphens , its not able to find the xpath i have tried for the given html

<div class="a-section a-spacing-none add-cc-number
    <input type="tel" id="pp-XQAs3V-15" autocomplete="off" name="addCreditCardNumber" class="a-input-text a-form-normal a-width-medium" data-testid="pmts-account-Number">
    </div>
</div>

When i use chropath it says It might be child of svg/pseudo element/comment/iframe from different src. Currently ChroPath doesn't support for them.

Xpath tried: //input[contains(name(),'ppw-accountHolderName')] tried with ancestor sibling too.

1

1 Answers

0
votes

name() is an XPath function to get te name of een element.

If the input has this name addCreditCardNumber use this:

//input[@name='addCreditCardNumber']