Exists() fails to locate visable item

Ask general questions here.
radimag
Posts: 11
Joined: Tue Jul 17, 2018 8:15 am

Exists() fails to locate visable item

Post by radimag » Wed Jul 18, 2018 2:47 pm

All,

I'm trying to check if a label exists on a web page, with Ranorex 8.2.

My module contains the following code:

Code: Select all

// Set a specific value to repository variable which is used to locate the label
Repository.Instance.varCurrentStep = "Recorded";

// Check the existance of the label
if (ReportItemInfo.Exists(60000)) {
        Report.Info("Recorded Claims page: exists");
}
else {
        Report.Info("Recorded Claims page: not exists");
}
Repository variable

Code: Select all

.//div[@title>$varCurrentStep]
Scenario 1:
- The web application is open on the page where the label is located
- I run the module
Outcome: The element is found. -> Works as expected

Scenario 2:
- I run a testcase in the test suite, which contains the above mentioned module. The testcase executes a flow on the web application with a couple of screens.
- When the page with the label is shown, the existence of the label is checked
Outcome: The element is not found. The Exists fails, although it is visible

Scenario 3:
- The web application is open on the previous page before the page where the label is located
- I adapt the module so that it navigates the page with the label
- I run the module
Outcome: The element is not found. The Exists fails, although it is visible

When I open the Ranorex spy and I copy past the RxPath (from the error in the report) in the spy, it cannot locate the item.
If I Track the label and next copy paste again the same RxPath from the report file, it can locate the label.

Does anyone know why Ranorex can't find the existence of the item in scenario 2 and 3?

Thanks in advance!

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

Re: Exists() fails to locate visable item

Post by odklizec » Thu Jul 19, 2018 2:38 pm

Hi,

Could you please post exact error message you got? Additionally, please post a Ranorex snapshot (NOT screenshot) of the problematic element. Without these details, it's almost impossible to tell what's wrong.

In a meantime, just some general ideas...
Have you tried to increase the Exists timeout?
Try to take the snapshot of any parent element, containing the searched element (at a time of search). Simply add Report >> Snapshot action before the Exists action. Then examine the xpath as stored in snapshot with the one stored in repository. In my opinion, there is an empty character at the end of the xpath or there is something completely different in the xpath stored in repo and the actual xpath in GUI.
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