0

This question already has an answer here:

i have to get the Inner text based on dom x- path, but in the x-path div value keeps changing. how do i do it in automation anywhere object cloning in Chrome browser.

The xpath I am using is:

/html/body/div[5]/div[1]/section[1]/div[2]/div[1]/div[1]/div[2]/div[1]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[2]/div[1]/div[1]/div[1]/div[2]/div[2]/div[1]/div[1]/div[1]/table[1]/tbody[1]/tr[1]/td[5]/span[1]/span[1] /html/body/div[5]/div[1]/section[1]/div[2]/div[1]/div[1]/div[3]/div[1]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[2]/div[1]/div[1]/div[1]/div[2]/div[2]/div[1]/div[1]/div[1]/table[1]/tbody[1]/tr[1]/td[5]/span[1]/span[1] 

marked as duplicate by Nitin Rastogi, Bharat Mane, Michael Durrant, Kevin McKenzie, NarendraC May 8 at 10:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • /html/body/div[5]/div[1]/section[1]/div[2]/div[1]/div[1]/div[2]/div[1]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[2]/div[1]/div[1]/div[1]/div[2]/div[2]/div[1]/div[1]/div[1]/table[1]/tbody[1]/tr[1]/td[5]/span[1]/span[1] /html/body/div[5]/div[1]/section[1]/div[2]/div[1]/div[1]/div[3]/div[1]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[2]/div[1]/div[1]/div[1]/div[2]/div[2]/div[1]/div[1]/div[1]/table[1]/tbody[1]/tr[1]/td[5]/span[1]/span[1] – user39410 May 6 at 15:23
  • 2
    My guess is this is your xpath, post some html code of the element instead - via edit option in your post, not via comments. – Moro May 6 at 16:50
2

I'd try first of all seeing in the webpage source if the element has a unique ID so instead you can use something like

driver.findElement(By.ID("ABCD")

If the element doesn't have a unique ID or name, add some html of the element and I'll happily help to try and find a unique locator for the element

Not the answer you're looking for? Browse other questions tagged or ask your own question.