How to load a URL in browser without using get() or navigate() method

Hello Folks,

In last post, we have seen in details how to open a URL in selenium webdriver.

Do you know that we can open a URL without using any browser as well?  It is frequently asked interview question as well. Let’s learn it.

Let’s perform some steps first:

  1. Open a browser.
  2. Press F12.
  3. Switch to Console tab.
  4. Type ” window.location=’’ “(exclude double quotes) and hit Enter key.
  5. You will notice that redbus website is loaded.

This is the way of loading URL without using any methods like get() or navigate(). Above statement is called as javaScript command. We will see javaScript concepts later. In this post we will just learn how to execute a javaScript command through selenium.

Complete JAVA program:


  1. It also holds the execution of next statement till website is loaded completely.
  2. It also throws page load time exception after 300 seconds.
  3. It also keeps current browser session history and you can navigate back and forward.

Java Program:

Execution Starts
Browser opened.

My first very small post. I hope you must have learnt new concept.

If you like my posts, please like, comment, share and subscribe. If you have any feedback or suggestions, feel free to contact me.

Thank you!!



Author: Amod Mahajan

My name is Amod Mahajan and I am an IT employee with 4+ years of experience in Software testing and staying in Bengaluru. My area of interest is Automation testing. I started from basics and went throw so many selenium tutorials. Thanks to Mukesh Otwani as his tutorials are easy and cover basics to advance. I have habit of exploring concepts by deep diving. I used to make notes. I thought of sharing my knowledge through posts and now I am here. #KeepLearning #ShareLearning