Latest Posts

Browser Navigation using Selenium WebDriver



package demopackage; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class Class4 { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\\Work\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get("https://www.facebook.com"); System.out.println("title is : "+driver.getTitle()); driver.navigate().to("https://www.gmail.com"); // for navigation to another url System.out.println("title is : "+driver.getTitle()); driver.navigate().back(); System.out.println("title is : "+driver.getTitle()); driver.navigate().forward(); System.out.println("title is : "+driver.getTitle()); } }


No comments:

Post a comment