Selenium Webdriver Scripts - WebDriver.Navigation



package selenium_examples;

import java.util.concurrent.TimeUnit;

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


public class spicejet {

public static void main(String[] args) {

WebDriver driver = new FirefoxDriver();
driver.navigate().to("http://www.google.com");
driver.findElement(By.id("gbqfbb")).click();
driver.navigate().back();
driver.manage().timeouts().implicitlyWait(20,TimeUnit.SECONDS);
driver.navigate().forward();
driver.manage().timeouts().implicitlyWait(20,TimeUnit.SECONDS);
driver.navigate().refresh();
System.out.println("done!");

}
}

navigate.back() - Performs browser back button action
navigate().forward() - Performs browser forward button action
navigate.refresh() - It refreshes the current page
navigate.refresh() - Navigates to particular URL



No comments:

Related Posts Plugin for WordPress, Blogger...

Fun and Knowledge