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");
}
Code: Select all
.//div[@title>$varCurrentStep]
- 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!