-
Notifications
You must be signed in to change notification settings - Fork 0
/
NavigateCommands.java
49 lines (31 loc) · 1.1 KB
/
NavigateCommands.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package newpackage;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class NavigateCommands {
public static void main(String[] arg) {
System.setProperty("webdriver.gecko.driver","/home/shilpatailor/Driver/geckodriver");
WebDriver driver = new FirefoxDriver();
// Put an Implicit wait,
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
// Open ToolsQA web site
String appUrl = "http://www.DemoQA.com";
driver.get(appUrl);
driver.manage().window().maximize();
String strPageTitle = driver.getTitle();
System.out.println("Page title: - "+strPageTitle);
// Click on Registration link
driver.findElement(By.xpath(".//*[@id='menu-item-374']/a")).click();
// Go back to Home Page
driver.navigate().back();
// Go forward to Registration page
driver.navigate().forward();
// Go back to Home page
driver.navigate().to(appUrl);
// Refresh browser
driver.navigate().refresh();
// Close browser
driver.close();
}
}