Validate.Exists to initialize
Posted: Thu Sep 11, 2014 8:32 am
Hello
I have a general question and wonder if you could help
in order to play safe and at the same time not to waste time I am doing very similar thing twice always in the code:
the purpose is to
1) control the process and to act only if Login exists
2) not to waste some default search time as it would be in case if I replaced it with only one line
loginWindow = repo.LoginWindow.Self. So if it didnt exist it would have waited much longer than 20s - I dont want to replace default wait time as in other case I want to wait longer
I dont like what I am doing as it seems that
1) the same thing is done twice - ie Ranorex is searching for teh same object first time when I am checking whether it exists and second time when I am initializing loginWindow - so twice amount of search time
2) the code is longer
is it possible to achieve the same result in a better way (for example initializing loginWindow at the time when I am doing Exists)?
thanks for your help,
rotciv
I have a general question and wonder if you could help
in order to play safe and at the same time not to waste time I am doing very similar thing twice always in the code:
Code: Select all
if (Validate.Exists(repo.LoginWindow.SelfInfo.AbsolutePath, new Duration(20000),
"Check Object '{0}'", new Validate.Options(false, ReportLevel.Info)))
{
var loginWindow = repo.LoginWindow.Self;
...
1) control the process and to act only if Login exists
2) not to waste some default search time as it would be in case if I replaced it with only one line
loginWindow = repo.LoginWindow.Self. So if it didnt exist it would have waited much longer than 20s - I dont want to replace default wait time as in other case I want to wait longer
I dont like what I am doing as it seems that
1) the same thing is done twice - ie Ranorex is searching for teh same object first time when I am checking whether it exists and second time when I am initializing loginWindow - so twice amount of search time
2) the code is longer
is it possible to achieve the same result in a better way (for example initializing loginWindow at the time when I am doing Exists)?
thanks for your help,
rotciv