forked from Sonal0409/8PMJulyBatchJava-SeleniumPrograms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWikiPageDemo.java
More file actions
90 lines (30 loc) · 1.67 KB
/
WikiPageDemo.java
File metadata and controls
90 lines (30 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package seleniumScripts;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class WikiPageDemo {
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "C:\\Users\\vishal mittal\\Downloads\\chromedriver_win32 (12)\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize(); // maximize the browser window
driver.manage().deleteAllCookies(); // delete cookies on the browser
driver.get("https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&returnto=Selenium+%28software%29");
// locate the text box and enter data in the text box
driver.findElement(By.id("wpName")).sendKeys("Username1");
Thread.sleep(3000);
// Inspect password textbox and enter data in the text box
driver.findElement(By.name("wpPassword")).sendKeys("password@123");
// Inspect confirm password and enter data
// inspect email address text box and enter data
// inspect button and click() on it
driver.findElement(By.xpath("//button[@value='Create your account']")).click();
driver.navigate().to("https://ironspider.ca/forms/checkradio.htm");
Thread.sleep(3000);
driver.findElement(By.xpath("//input[@value='yellow']")).click();
Thread.sleep(3000);
driver.findElement(By.xpath("//input[@value='blue']")).click();
// finding checkbox and clicking onit
driver.findElement(By.xpath("//*[@id=\"Content\"]/div[1]/blockquote[2]/form/input[1]")).click();
}
}