Load the Page

After a browser is launched, then time to go get our web page.

GET
We can load our web page via get() method:

driver.get(“http://www.automediator.com”);

Loading page via GET is BLOCKING
driver.get() will load the page and wait until the page is fully loaded. In another word, webdriver will not return control to your code till onload event has fired. It waits for DOM readyState to signal complete

How ever, if your page uses redirects via AJAX requests, Selenium doesn’t wait for them to finish and webdriver may not know when it has completely loaded. If you need to ensure such pages are fully loaded then you can use waits.

Navigate
We can navigate to other pages using .navigate() method:

driver.navigate().to(“http://www.automediator.com”);

Both .get() and .navigate() bring us to a page. What’s the difference?
driver.navigate.to(..): navigate to the specific URL, then get. No difference, one is just shorter!

But with navigation you can move backwards and forwards in your browser’s history:

driver.navigate().forward();
driver.navigate().back();

Refresh
We can refresh the current page using .refresh() method:

driver.refresh();

Navigate vs Refresh
Navigate reloads the document currently displayed in the web Browser control.

Refresh simply reloads the current page, so the Navigating, Navigated, and DocumentCompleted events do not occur when you call the Refresh method.

7 thoughts on “Load the Page

  1. Good day I am so grateful I found your weblog, I really found you
    by mistake, while I was looking on Bing for something else, Anyhow
    I am here now and would just like to say thank you
    for a remarkable post and a all round enjoyable blog (I also love the
    theme/design), I don’t have time to browse it all at
    the minute but I have bookmarked it and also added in your RSS feeds, so when I have
    time I will be back to read a great deal more, Please do keep up the
    awesome jo.

  2. Its such as you learn my mind! You seem to know a lot approximately this, such as you wrote the book
    in it or something. I believe that you just can do with
    some % to pressure the message home a bit, but instead of that, this is fantastic blog.
    An excellent read. I’ll certainly be back.

  3. Hello this is somewhat of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML.
    I’m starting a blog soon but have no coding
    know-how so I wanted to get guidance from someone with experience.
    Any help would be enormously appreciated!

  4. Good day! Would you mind if I share your blog with my myspace group?
    There’s a lot of folks that I think would really appreciate your content.
    Please let me know. Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *