Sample selenium test scripts for navigating an application

Views: 263   

In this tutorial, I explain how to write webdriver test script for navigating an application.
Let us try to create a WebDriver script that would:

  1. Open Google application
  2. Clicks on "Sign in"
  3. Navigating (Back & Forward)
  4. Refresh

WebDriver Script:

package com.selenium.practise;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

public class GoogleNavigation {

    public static void main(String[] args) {

        System.setProperty("", "E:\\Soft Wares\\chromedriver.exe");
        // Set path created for ChromeDriver 

        WebDriver driver = new ChromeDriver();
        // -> Here we are using ChromeDriver. 
        // -> ChromeDriver() object created and assigned object to WebDriver interface

        WebDriver.Navigation move = driver.navigate();
        // navigate() allows the driver navigate to URL and access the browser's history
        // WebDriver.Navigation is interface"http:\\");
        // Get Google application

        // clicking on Sign in

        // moves forward to Sign in page

        // moves back to Google main page

        // refresh current page

        // close application

        System.out.println("Navigation is success");

On By