79600808

Date: 2025-04-30 17:14:40
Score: 0.5
Natty:
Report link

you can use relative path to identify your target element

syntax:

//tagName[ @Attribute='AttributeValue']

<input type='button'> --> input - tagName , type -> Attribute , button -> Attribute Value

// button[ @type='button'] -- > in your case , this identified more than 15 elements , so you are trying to hardcoded 15 element

so we can also use some conditional statement also like and , or key word

let suppose your element has some other attribute and value are avaialble

let

<button type="button" name="submit"> Button Field </button>

//button[ @type='button' and @name='submit'] --> here we used and condition ( if both matched then only it will try to identify the element)

//button[ @type='button' or @name='submit'] --> here we used or condition ( if any one of the attribute matched then it will identify element)

by using above and and or condition , may be your count will be definaltely reduced ( earlier it identified more than 15 elements)

if suppose even after applied and or or conditions still you are not able to identify the elements uniquely

then you can also use the xpath axes

parent , child , ancestor , descendant , siblings

//tagName[@Attribute='value']//parent::tagName

//tagName[@Attribute='value']//child::tagName

//tagName[@Attribute='value']//ancestor::tagName

//tagName[@Attribute='value']//descendant::tagName

//tagName[@Attribute='value']//following-sibling::tagName//child::tagName

you can also identify by using contains , starts-with , normalize-space, text method also

//tagName[contains(@attribute, 'Attributevalue']

//tagName[starts-with(@attribute, 'Attributevalue']

//tagName[text()='Attributevalue']

//tagName[normalize-space(@attribute), 'Attributevalue']

By using all of these techniques you can able to uniquely identify element

please share the html code we can help yu better way

Reasons:
  • Whitelisted phrase (-1.5): you can use
  • Whitelisted phrase (-1): in your case
  • RegEx Blacklisted phrase (2.5): please share
  • Long answer (-1):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Brahmananda Reddy Sadhu