Question

Unable to deal with Domx Path


Badge +4

Hello Everyone!!

I have to create a bot to click on each profile button in the page and extract the details. In general, to do so we have to iterate with the minute change in the Domx path.

 

But in this case, I could not found a proper relation with the paths.

The following are paths of Profile buttons in the page.

//div[@id='root']/div[1]/div[1]/div[3]/div[1]/div[2]/div[2]/div[2]/div[5]/div[1]/div[4]/div[2]/div[1]/div[1]/button[1] 
//div[@id='root']/div[1]/div[1]/div[3]/div[1]/div[2]/div[2]/div[2]/div[5]/div[2]/div[5]/div[2]/div[1]/div[1]/button[1] 
//div[@id='root']/div[1]/div[1]/div[3]/div[1]/div[2]/div[2]/div[2]/div[5]/div[3]/div[5]/div[2]/div[1]/div[1]/button[1] 
//div[@id='root']/div[1]/div[1]/div[3]/div[1]/div[2]/div[2]/div[2]/div[5]/div[4]/div[4]/div[2]/div[1]/div[1]/button[1] 
//div[@id='root']/div[1]/div[1]/div[3]/div[1]/div[2]/div[2]/div[2]/div[5]/div[5]/div[5]/div[2]/div[1]/div[1]/button[1] 
//div[@id='root']/div[1]/div[1]/div[3]/div[1]/div[2]/div[2]/div[2]/div[5]/div[6]/div[5]/div[2]/div[1]/div[1]/button[1] 
//div[@id='root']/div[1]/div[1]/div[3]/div[1]/div[2]/div[2]/div[2]/div[5]/div[7]/div[5]/div[2]/div[1]/div[1]/button[1] 
//div[@id='root']/div[1]/div[1]/div[3]/div[1]/div[2]/div[2]/div[2]/div[5]/div[8]/div[5]/div[2]/div[1]/div[1]/button[1] 
//div[@id='root']/div[1]/div[1]/div[3]/div[1]/div[2]/div[2]/div[2]/div[5]/div[9]/div[5]/div[2]/div[1]/div[1]/button[1] 
//div[@id='root']/div[1]/div[1]/div[3]/div[1]/div[2]/div[2]/div[2]/div[5]/div[10]/div[4]/div[2]/div[1]/div[1]/button[1]

 

Can someone help me out this ? 


3 replies

Userlevel 4
Badge +14

Hi @SaiRahul02 ,

Instead of extracting the full xPath, can you please share the xPath of those elements

Badge +4

Hi @SaiRahul02 ,

Instead of extracting the full xPath, can you please share the xPath of those elements

I didn’t get you. The above mentioned are the different Domx paths of the same element at different levels

Badge +1

Please try to create custom domx path using common properties(like text, class) of all the profile buttons.
Along with this you can add a occurrence counter to common path.

You can create a custom path like (//div[@id='root']//button[text()=”Profile”])[##] depending on the actual values in HTML content. (## will be number of button)

 

Reply