Search code examples
htmlcssxmlautomationanywhere

How to write the relative path expression (XPath) to extract the email address from the following screenshot?


enter image description here

I see that the absolute path keeps on changing.

1) //div[@id='details']/div[2]/div[2]/div1/div[2]/dl[8]/dd1

2) //div[@id='details']/div[2]/div[2]/div1/div[2]/dl[7]/dd1

Need your help in writing the relative expression in place of the absolute expression.

This is for using with Automation Anywhere for automating a website. Website:https://www.fakenamegenerator.com/gen-male-sp-nz.php

Thanks in advance


Solution

  • Try this one:

    //dl[dt/text()='Email Address']/dd
    

    It means:

    1. Find a dl element that has a direct child dt element with text 'Email Address'
    2. Find a direct child element dd under the dl element

    You can then use it in Object Cloning, for example.