To deal with that I've been trying to use IFs like "if fieldX exists then do this, else do this other thing" but the program always stops working whenever the first if turns out to be false.
Here is a code snippet:
Code: Select all
public void signIn(String username, String password) {
Program.waitUntilLoaded(dom);
repo.signInPage.User.PressKeys(username);
repo.signInPage.Passwd.PressKeys(password);
if (repo.signInPage.NucaptchaAnswerInfo.Exists()) {
repo.signInPage.NucaptchaAnswer.PressKeys("answer");
}
repo.signInPage.SignIn.Click();
}
If repo.signInPage.NucaptchaAnswerInfo.Exists() returns TRUE then it works perfectly but if it should return FALSE the program would just hang in there waiting eternally. I tried changing the timeout on the object in the repository to see if it was waiting to see if it eventually showed up before returning a FALSE but no luck.
I know it's probably something very easy but I can't figure out what I'm doing wrong.
Thanks.