XPATH PROBLEMN

I am new to XPATH

this is the website

where i am writing XPATH corresponding this .

You will see 4 add+ buttons . Inspect it and see the html code .

Writing this XPATH in console in dev tools of chrome
$x("//div[@id=‘feature-product-product-list-div’]//li[starts-with(@id,‘store_product_li’)]//button")

Gives me 4 buttons which is right .

I wrote this below XPATH in CONSOLE coz i found it somewhere in what’s app without explaining what this XPath does .

$x("//div[@id=‘feature-product-product-list-div’]//li[starts-with(@id,‘store_product_li’)]//button[1]")

I see that this XPATH returns also those 4 buttons .

But when i write this

$x("//div[@id=‘feature-product-product-list-div’]//li[starts-with(@id,‘store_product_li’)]//button[2]")

$x("//div[@id=‘feature-product-product-list-div’]//li[starts-with(@id,‘store_product_li’)]//button[3]")

it returns an empty array .
Why so?

1 Like

Hey @Saumyojit_Das

Are you using this somewhere in UiPath ?

Thanks
#nK