Because the remote connection shows up a one large image to Ranorex, I need to apply the appropriates events according to the current screen content.
For example, if the screen tells me to select which login I was to use, I must click in the right location of the screen to use that login. When I see the Windows logo at the bottom left corner of the desktop, I can end my test with a success indicator.
My UserCode has to match a few different images and react with the appropriate answer to eventually complete a login sequence and reach the desktop. In my UserCode I have a loop that matches 5 or 6 visual information that trigger an answer. If a test for image fails, it is OK, I just match the next screen, until I get a match, to provide the right answer.
Code: Select all
while (... until timeout...)
{
if (Validate.ContainsImage(MyRepo.Forme.Ecran.Win2012Info, Win2012_Admin, Options,
"Validation of the password screen", false)) {
Report.Log(ReportLevel.Info, "Keyboard", "Enter password.");
Keyboard.Press(Password);
}
if (Validate.ContainsImage(MyRepo.Forme.Ecran.Win2012Info, Win2012_Desktop, Options,
"Validation of the Desktop 2012R2 screen'", false)) {
Report.Log(ReportLevel.Info, "Mouse", "Desktop 2012R2 detected.");
return; // SUCCESS
}
if (Validate.ContainsImage(MyRepo.Forme.Ecran.Win2012Info, Win2012_ErrPassword, Options,
"Validation of invalid password screen'", false)) {
Report.Log(ReportLevel.Info, "Mouse", "Invalid password - new attempt.");
MyRepo.Forme.Ecran.Self.MoveTo("515;278");
MyRepo.Forme.Ecran.Self.Click("515;278");
}
}
When I validate my images, I specified FALSE for the last parameter because I only need to check if the image exist, if if does not exist, that is fine, I just check for the next image.
I think Ranorex "remembers" these errors anyway and report the test as a failure. What can I do to fix this?