find element with changing id in the html code

  • 1 Replies
  • 786 Views
find element with changing id in the html code
« on: June 08, 2016, 21:51:10 pm »
I'm writing selenium code for an app where the element's id are changing randomly. so if I try to locate a id, next time I run the selenium code i get an error because the id changes for next run

What can i do to capture ids every run ?

Re: find element with changing id in the html code
« Reply #1 on: June 14, 2016, 09:17:08 am »
For what you are describing locating elements by Id is not a good choice.

You would have much more success using different techniques such as class, xpath, or a combination of both

If you link a piece of your HTML code I could try to help you write a decent xpath/css locator.

 

Sitemap 1 2 3 4 5 6 7 8