Ranorex spy unable to locate element without sccroll

Ranorex Spy, Recorder, and Studio.
rahulnair87
Posts: 2
Joined: Sun Apr 12, 2020 7:58 am

Ranorex spy unable to locate element without sccroll

Post by rahulnair87 » Sun Apr 12, 2020 8:33 am

Hi Team,

My next project is using Ranorex and I am trying to learn this using the evaluation version.
Coming to the issue, I am trying to select an item in a e-commerce website that it present like two pages(scroll down) from the home page.

I scrolled down to the element and then located the element in spy as in below screenshot.
Spy1.PNG
Spy1.PNG (51.51 KiB) Viewed 86 times
After this the Spy is always able to highlight the element even if I scroll up or down.

Now, if I close the browser session and launch a new session and navigate to the same page, Spy is unable to locate the item. Please note I have not scrolled down.
Spy2.PNG
Spy2.PNG (46.33 KiB) Viewed 86 times
Does Spy always require me to scroll down to bring the element in focus to re-link the object?

And the second question - How to perform the scroll down until the element is visible and perform the click?
I have searched the forum, and tried the below piece, but the itemAdapter return null if the object is not in focus. Please provide any help possible on this matter.

public static void ScrollToElementAndClick(RepoItemInfo repoInfoElement){

if (repoInfoElement != null){
Ranorex.Unknown itemAdapter = repoInfoElement.CreateAdapter<Ranorex.Unknown>(false);
do {Keyboard.Press("{Next}");
} while (itemAdapter.Visible == false);
itemAdapter.Click();
}
}

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

Re: Ranorex spy unable to locate element without sccroll

Post by odklizec » Tue Apr 14, 2020 9:46 am

Hi,

Could you please post a Ranorex snapshot (NOT screenshot) of the page in question? Ideally, please post two snapshots. One before scroll and the other one after scroll. And please post also full xpath to the element in question (not in form of screenshot). Thanks.
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