forked from RexJonesII/FreeCodeCampSeleniumJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasePage.java
More file actions
36 lines (28 loc) · 729 Bytes
/
Copy pathBasePage.java
File metadata and controls
36 lines (28 loc) · 729 Bytes
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
package com.base;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
public class BasePage {
public static WebDriver driver;
public void setDriver(WebDriver driver) {
BasePage.driver = driver;
}
protected WebElement find(By locator) {
return driver.findElement(locator);
}
protected void set(By locator, String text) {
find(locator).clear();
find(locator).sendKeys(text);
}
protected void click(By locator) {
find(locator).click();
}
public static void delay(int milliseconds) {
// Demo Purpose
try {
Thread.sleep(milliseconds);
} catch(InterruptedException exc) {
exc.printStackTrace();
}
}
}