-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobj_repo.java
More file actions
42 lines (36 loc) · 1.6 KB
/
obj_repo.java
File metadata and controls
42 lines (36 loc) · 1.6 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
package selenium;
import java.io.FileInputStream;
//import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class obj_repo {
public static void main(String[] args) throws IOException {
System.setProperty("webdriver.chrome.driver", "C://Users//admin//workspace//Auto/chromedriver.exe");
WebDriver driver = new ChromeDriver();
String baseUrl = "https://accounts.google.com/signin/v2/identifier?flowName=GlifWebSignIn&flowEntry=ServiceLogin";
driver.manage().window().maximize();
Properties pro = new Properties();
FileInputStream file = new FileInputStream(System.getProperty("user.dir")+"\\app.properties");
pro.load(file);
driver.manage().deleteAllCookies();
driver.get(baseUrl);
WebElement fld1 = driver.findElement(By.xpath(pro.getProperty("email_box_locator")));
fld1.clear();
fld1.sendKeys("user@email.com");
WebElement clk1 = driver.findElement(By.xpath(pro.getProperty("next1")));
clk1.click();
WebDriverWait wait = new WebDriverWait(driver,20);
wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath(pro.getProperty("pass_locator"))));
WebElement pass = driver.findElement(By.xpath(pro.getProperty("pass_locator")));
pass.clear();
pass.sendKeys("password");
WebElement clk2 = driver.findElement(By.xpath(pro.getProperty("next2")));
clk2.click();
}
}