-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAutomationTool.java
More file actions
60 lines (49 loc) · 1.82 KB
/
Copy pathAutomationTool.java
File metadata and controls
60 lines (49 loc) · 1.82 KB
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
50
51
52
53
54
55
56
57
58
59
60
package org.demo.tool;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
//import java.util.concurrent.TimeUnit;
public class AutomationTool {
protected WebDriver driver;
protected String sBrowserName;
protected WebElement element;
protected By username;
protected By password;
protected By logniButton;
protected By burgerMenuButton;
public AutomationTool() {
driver = null;
sBrowserName = null;
element = null;
username = new By.ById("user-name");
password = new By.ById("password");
logniButton = new By.ById("login-button");
burgerMenuButton = new By.ById("react-burger-menu-btn");
}
public Boolean OpenBroswer(String sBroswerType){
if(sBroswerType.equalsIgnoreCase("chrome")){
System.setProperty("webdriver.chrome.driver", "D:\\Selenium_Projects\\SaucedemoProject\\src\\main\\resources\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().window().maximize();
}
return true;
}
public Boolean GoToPage(String sUrlSite){
driver.get(sUrlSite);
return true;
}
public void LoginSubmit(String sUserName, String sPassword){
driver.findElement(username).sendKeys(sUserName);
driver.findElement(password).sendKeys(sPassword);
driver.findElement(logniButton).submit();
}
public Boolean ClickBurgerButton(){
driver.findElement(burgerMenuButton).click();
return true;
}
public void CloseBrowser(){
// driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.quit();
}
}