Forum Discussion
Resolved by putting the username in the Login Hint field and keeping the JavaScript for the password on page 2.
I don't think you need a switch statement for this at all. It doesn't make sense to use a switch statement to make a decision between two boolean values. I'd write the code like this:
var panelButtons = page.FindChildEx("Name", "Panel(3)", 10, true, 10000); //thanks to Alex for suggesting ‘FindChildEx’ var btnAccept = panelButtons.FindChild("idStr", "ctl00_MainContent_btnAcceptEula", 10); page.Wait(); if (btnAccept.Exists){ Log.Message("EULA page loaded."); btnAccept.scrollIntoView(false); btnAccept.ClickButton(); } else { Log.Message("EULA page did not load."); }
Hi Robert
To the rescue again!! :D I did think about if - else, but I thought the switch was better suited. Couldn't make it work!
I don't know how to thank you!
Regards.
Dave
Hi Dave,
Usually, Switch statement evaluates the expression in its main 'switch' clause and compares the result to the options provided in the 'case' clauses. So your Switch block should look like this:
switch (btnAccept.Exists) { case true: Log.Message("EULA page loaded."); btnAccept.scrollIntoView(false); btnAccept.ClickButton(); break; case false: Log.Message("EULA page did not load."); break; }
Related Content
Recent Discussions
- 5 days ago