Check if website loads

I have an open browser activity to open a website. But I want to check if it loads the page continue else a pop up message would appear.

Would it be best to use a Try Catch or do I just use an if statement to check if the website loads by looking for an element on the page.

The best practice is to check for an element which will only appear on the page if the page successfully loads. Make sure it’s something that is likely to always be there even if the site changes (if possible). Use that to determine if the page loaded correctly.

You can use this in tandem with the Catch block so you’ll be able to handle various exceptions in specialized ways.

1 Like

Do you suggest to put the open browser activity inside a try catch

That will work. Just make sure you’re checking for a loaded element. This can be done with Element Exists.

Ok thank you

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.