I am writing some Java Webdriver code to automate my application. How can I correctly check whether the page has been loaded or not? The application has some Ajax calls, too
You can set a JavaScript variable in your WepPage that gets set once it's been loaded. You could put it anywhere, but if you're using jQuery, $(document).onReady isn't a bad place to start. If not, then you can put it in a tag at the bottom of the page.
The advantage of this method as opposed to checking for element visibility is that you know the exact state of the page after the wait statement executes.
... All my page content ...