Here's the user code we use to wait for the command prompt to appear which typically takes about 5-10 minutes.
Couple of questions regarding this code:
1. We intend to limit the search area to a subsection of the object. Is this code written correctly to only search within a certain area or is it doing image recognition on the entire object. As is, this code has been working for some time.
2. Is there a better way to "wait for image exists" logic?
Code: Select all
public void Validate_MKSEmbedded1()
{
Report.Log(ReportLevel.Info, "Validation", "(Optional Action)\r\nValidating ContainsImage (Screenshot: 'scr_Initial_Login_Promt' with region {X=3,Y=62,Width=449,Height=19}) on item 'MkphysvcMkQaHytrustComVSphereCli.MainInventory.MKSEmbedded1'.", repo.MkphysvcMkQaHytrustComVSphereCli.MainInventory.MKSEmbedded1Info);
int count = 0;
bool found = false;
Validate.EnableReport = false;
do {
try {
if (Validate.ContainsImage(repo.MkphysvcMkQaHytrustComVSphereCli.MainInventory.MKSEmbedded1Info,
MKSEmbedded1_scr_Initial_Login_Promt, MKSEmbedded1_scr_Initial_Login_Promt_Options,
Validate.DefaultMessage, false)) {
found = true;
}
} catch (Exception e) {
e.ToString(); //line to save e for future use
//don't do anything
}
Thread.Sleep(1000);
count++;
} while (!found && count <= 600);
Validate.EnableReport = true;
Report.Log(ReportLevel.Debug, "boot up took " + count);