Page 1 of 1

Ranorex can't find element

Posted: Fri Sep 06, 2019 2:37 pm
by AviatorFly
Hi All,

I am trying to automate a button click to send a message to someone on linkedin website. Everytime, I visit the particular page for my friend's profile the message button appears to have a different path.

On the first run, I got the path below

.//div[#'ember5']/div[5]/div[3]/div/div[2]/div/div[2]/div/div//ul/li/div/div/div[3]//button[@innertext='Message']

On the second run, ranorex could not find the element and I noticed that the path had changed to the path below

.//div[#'ember7']/div[5]/div[3]/div/div[2]/div/div[2]/div/div//ul/li/div/div/div[3]//button[@innertext='Message']

As you can see, looks like that the first time I went to that page "ember5" was in the path however the second time I went to the same page "ember7" was in the path.

Attached is a screenshot using the spy tool.

Can someone recommend a way to fix this problem so I can always find that Message button on the linkedin website?

Thanks

Ricardo

Re: Ranorex can't find element

Posted: Sun Sep 08, 2019 3:49 pm
by odklizec
Hi,

Could you please upload a Ranorex snapshot (NOT screenshot) of the problematic element?

Generally speaking, you will most probably have to update each recorded xpath to make it independent from dynamic ID. The xpath could look like this:
.//div[@id~'ember']/div//button[@innertext='Message']
If the xpath returns more than one element, you will have to make more specific, by adding some more element. I would strongly recommend to avoid all index numbers, which are highly volatile and prone to changers.

Re: Ranorex can't find element

Posted: Fri Oct 04, 2019 7:49 pm
by AviatorFly
Thanks I figured it out on my own