blob: f4c5ec3ed5d784124c0e1d55aa82290f53c6807a (
plain)
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
|
package com.mavlushechka.a1qa.driverUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import java.util.List;
public class WebDriverUtils {
private final static WebDriver webDriver = WebDriverSingleton.getInstance();
private WebDriverUtils() {
}
public static void goToAddress(String address) {
webDriver.get(address);
}
public static WebElement findElement(By locator) {
return webDriver.findElement(locator);
}
public static List<WebElement> findElements(By locator) {
return webDriver.findElements(locator);
}
public static int getWindowHandlesCount() {
return webDriver.getWindowHandles().size();
}
public static void switchToWindowHandle(int index) {
webDriver.switchTo().window(webDriver.getWindowHandles().toArray()[index].toString());
}
public static void close() {
webDriver.close();
}
public static void quit() {
webDriver.quit();
}
}
|