Cannot tell when a web page is not present
Using Firefox there is a new page that is sometimes displayed during my testing. When it is present there are no problems. When it is not I need to click a link to display the page.
The problem is that I get an error when the page is not there even though I am using the .Exists check in an if statement.
Reference the code that follows:
When the page https://somepage.com/* is present this has no problem. It falls right past the if statement correctly. However when the page is not present I get the error "The page 'https://somepage.com/*' was not found." instead of it going into the if statement and doing the click action.
CODE:
function AddSomething() {
var browser = Sys.Browser("*");
if( browser["Page"]("https://somepage.com/*")["Exists"] == false)
{
Aliases["MyLink"]["Click"]();
}
var Mypage = browser.Page("https://someplace.com/*");
Mypage .Wait();
do stuff ....
}
My bad.. I'm not used to C#Script syntax...
Should be as follows:function AddSomething() { var browser = Sys.Browser("*"); if( browser["WaitPage"]("https://somepage.com/*", 0, 20000)["Exists"] == false) { Aliases["MyLink"]["Click"](); } var Mypage = browser.Page("https://someplace.com/*"); Mypage .Wait(); do stuff .... }