Any work around constant changing div on google input filed?

hello so i’m trying to automate a process but i noticed that the input fields div changes from time to time might be due to me using vpn and new ip all the time ?

xpath=/html/body/c-wiz/div[2]/div[2]/section/div/div/div/c-wiz[2]/div/div/div/div/input

xpath=/html/body/c-wiz/div[3]/div[2]/section/div/div/div/c-wiz[2]/div/div/div/div/input

and this cause macro to stop

another question is can comment with text what click this is as i have over 100 of them and i get lost in them when an error happens
image

Use another xpath, there are a large amount of different xpath for every element you see in the webpage

I use always external tool to detect good xpath, ui vision do not record good xpath

To detect xpath that change you can use xpath axes, these detect every element in the page with anchor,

1 Like

@newuserkantu Now I am curious. What tool do you use, and how is that better than the XPath’s that UIvision suggests?

@Rico_DYellow Some websites e. g. Facebook change their ID and page structure on purpose to avoid automation. On many other websites this simply happens due to dynamic content or page updates in general.

If only the ID of the elements changes see here:

If the structure changes like from div[2] to div[3] as in your case I would try to find a more robust XPath, like @newuserkantu suggested. Sometimes this is possible, but not always!

However, if more changes - or if I am lazy :yum: and need a quick solution - I usually simply switch to using visual automation with XClick | (image/OCR). This works always. The drawback is that it is slower than XPath-based macros. But for many macros run time is not a problem, so that is fine.

1 Like

On google Chrome I use all addons to detect xpath, I installed all addon to do this.

I have a long list of xpath finder and usually it detect more xpath of ui vision

Here an image

1 Like

@newuserkantu Thanks, that is a nice toolbox of XPath helpers! We will look at them and see what we can learn from it :slight_smile:

1 Like

To solve some cases of dynamic IDs I had to use different xpaths that ui vision did not record, in some cases to create good automation you need an xpath, you can also combine 2 different xpaths together with the OR command and this allows you to more accurately identify an element.

I’m quite new to it so not sure if you can share one example so I can learn from it.