Ranorex can't find element

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
AviatorFly
Posts: 1
Joined: Fri Sep 06, 2019 2:21 pm

Ranorex can't find element

Post by AviatorFly » Fri Sep 06, 2019 2:37 pm

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
Attachments
Ranorex.JPG
Ranorex.JPG (108.54 KiB) Viewed 619 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5071
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Ranorex can't find element

Post by odklizec » Sun Sep 08, 2019 3:49 pm

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.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration