-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGuru99.java
More file actions
69 lines (44 loc) · 1.67 KB
/
Guru99.java
File metadata and controls
69 lines (44 loc) · 1.67 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
61
62
63
64
65
66
67
68
69
package Day7;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
public class Guru99 {
ChromeDriver driver;
public void invokeBrowser() {
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.get("http://demo.guru99.com/v4");
}
public void login(String username, String password) {
WebElement userId;
userId = driver.findElement(By.name("uid"));
userId.sendKeys(username);
driver.findElement(By.name("password")).sendKeys(password);
driver.findElement(By.name("btnLogin")).click();
}
public void addAccount(String custumerId) {
driver.findElement(By.linkText("New Account")).click();
System.out.println("clicked");
WebElement iframe1 = driver.findElement(By.id("google_ads_iframe_/24132379/INTERSTITIAL_DemoGuru99_0"));
driver.switchTo().frame(iframe1);
System.out.println("Switched!");
WebElement iframe2 = driver.findElement(By.id("ad_iframe"));
driver.switchTo().frame(iframe2);
System.out.println("Switched2");
driver.findElement(By.id("dismiss-button")).click();
System.out.println("clicked");
driver.switchTo().defaultContent();
driver.findElement(By.name("cusid")).sendKeys(custumerId);
WebElement selDropdown = driver.findElement(By.name("selaccount"));
Select selAccount = new Select(selDropdown);
selAccount.selectByVisibleText("Current");
driver.findElement(By.name("inideposit")).sendKeys("583465");
driver.findElement(By.name("button2")).click();
}
public void closeBrowser() {
//driver.close(); //close only the current browser
driver.quit(); //close all the browser
}
}