Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not going to Else (False) statement
#1
Solved: 11 Years, 3 Months, 4 Weeks ago
This seems to work. But if my browser is "Page not Found" ie the webserver is down, etc, the path in my code still goes to the "If" statement (True), and not to the "Else" (False).

Can I get a look at my code to see why, the Else (False) is not sellected, even though the web server is clearly down?

My code:-)

Code:
Browser("Wisdom").Page("WisdomLogin").WebElement("Welcome to Wisdom").WaitProperty "visible", True, 5000

If Browser("Wisdom").Page("WisdomLogin").WebElement("Welcome to Wisdom").GetROProperty("visible") Then  'Gets stuck here when "The page cannot be displayed"
       ''Browser Opened successfully in URL
       Reporter.ReportEvent micPass, "Browser in URL: " & DataTable.GlobalSheet.GetCurrentRow, "URL: " & " - opened SUCCESFULLY."
Else
       'Browser Failed to open in URL
        Reporter.ReportEvent micFail,"Browser in URL: " & DataTable.GlobalSheet.GetCurrentRow, "URL: " & " - opened UNSUCCESFULLY."
        Browser("Wisdom").Close
        ExitTest
End If
Should I change:

Code:
Valid = Browser("Wisdom").Page("WisdomLogin").WebElement("Welcome to Wisdom").WaitProperty "visible", True, 5000

If Valid Then 'Gets stuck here when "The page cannot be displayed"
Reply
#2
Solved: 11 Years, 3 Months, 4 Weeks ago
Hello,

Please try by using the below code:

Code:
If Browser("Wisdom").Page("WisdomLogin").WebElement("Welcome to Wisdom").Exist(5) Then  
       ''Browser Opened successfully in URL
       Reporter.ReportEvent micPass, "Browser in URL: " & DataTable.GlobalSheet.GetCurrentRow, "URL: " & " - opened SUCCESFULLY."
Else
       'Browser Failed to open in URL
        Reporter.ReportEvent micFail,"Browser in URL: " & DataTable.GlobalSheet.GetCurrentRow, "URL: " & " - opened UNSUCCESFULLY."
        Browser("Wisdom").Close
        ExitTest
End If

Regards,
Parminder
Reply
#3
Solved: 11 Years, 3 Months, 4 Weeks ago
Thx, I nvr relized that the Exist and WaitProperty werer so interchangeable.

bye
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Exist returns false with part of innertext Milindt43 1 2,928 02-23-2011, 09:56 PM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 3 Guest(s)