Is there any way to get an elements xpath by codes?

Hi

I got following questions. In my site, I created an address, but this new created address is not in the first location of address book after created.

Now I need to delete this address by codes after check if it is created successfully. So need to provide the xpath of delete button for new created address.

Like following

Now I’m able to find the address name by xpath: //li[contains(text(),\"Small Projects
"\)]

But I want to get this kind of xpath for the name after find it:
//*[@id=“containerBody”]/main/section/div/div[2]/div[18]/div[2]/ul/li[2]

because the delete buttons’ xpath is like following:
//*[@id=“containerBody”]/main/section/div/div[2]/div[18]/div[2]/a[2]

By get the names’ xpath, I will able to generate the xpath of delete button.

Any help. thanks.

new address.png

Ignore this ticket. I’ve find a way to solve this problem. thanks

2 Likes