XPath doesn't work for dynamic HTML

I found some XPaths chosen by Ui.Vision from recording don’t work well. It’s because many web pages use dynamic HTML. I have to research and change these XPaths to non-dynamic XPath every time. I tried to use OCR to solve this issue. But OCR sometimes can see the defined word sometimes can’t see it (yes, the same word). It feels that manually inputting a non-dynamic XPath is a more reliable solution compared with OCR.

Is there a better or workaround solution for this issue?

Can you provide a sample link to a website or a screenshot of the issue?

Thanks for your prompt reply Admin.

For example, if I use Record to click the “Compose” button in the Gmail, Ui.VIsion will use a Target like “xpath=//*[@id=”:kr"]/div/div". But, this Xpath will not work for a while as Gmail uses a dynamic id. So I have to change the Target to “//div[@gh=‘cm’]” which is a static element. The same issue has also been reported in stackoverflow for selenium.

Could you solve it? I have the same issue ;/

send your HTML code …

See also How to get the Selenium IDE commands to work with dynamic ID's

I have often dynamic HTML that only shows when I get close to the page part. For example table content that do populate while scrolling down. To get around that I usually try to do a click on the lower rows to make the table scroll and the HTML code visible. But keep in mind click became in general very slow, so if you do that very often in your page it can take a while. Therefore I wrote an algorithm that only clicks every o6 row or so.