-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDemo.java
More file actions
94 lines (82 loc) · 3.12 KB
/
Copy pathDemo.java
File metadata and controls
94 lines (82 loc) · 3.12 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
91
92
93
94
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class Demo {
private WebDriver cd;
@BeforeClass
public void setup() {
System.setProperty("webdriver.chrome.driver",
"C:\\Users\\AdithMR\\MY_MEGA\\SEM4\\ST\\PROJECT_REQ\\Drivers\\edgedriver_win64\\msedgedriver.exe");
cd = new ChromeDriver();
}
@Test
public void tc1() {
cd.manage().window().maximize();
cd.get("https://www.google.com");
}
@Test
public void tc2() {
WebElement searchBox = cd.findElement(By.name("q"));
searchBox.sendKeys("reddit");
searchBox.submit();
}
@Test
public void tc3() throws InterruptedException {
WebElement link = cd.findElement(By.partialLinkText("Reddit"));
link.click();
Thread.sleep(3000);
}
@Test
public void tc4() throws InterruptedException {
WebElement signInButton = cd.findElement(By.xpath("//span[.='Log In']"));
signInButton.click();
Thread.sleep(3000);
}
@Test
public void tc5() throws InterruptedException {
WebElement emailField = cd.findElement(By.id("login-username"));
emailField.sendKeys("Jan_Man69");
WebElement passwordField = cd.findElement(By.id("login-password"));
passwordField.sendKeys("Password123");
JavascriptExecutor js = (JavascriptExecutor) cd;
js.executeScript(
"document.querySelector(\"body > shreddit-app > shreddit-overlay-display\").shadowRoot.querySelector(\"shreddit-signup-drawer\").shadowRoot.querySelector(\"shreddit-drawer > div > shreddit-async-loader > div > shreddit-slotter\").shadowRoot.querySelector(\"#login > auth-flow-modal > div.w-100 > faceplate-tracker > button > span > span\").click();");
Thread.sleep(7000);
}
@Test
public void tc6() throws InterruptedException {
WebElement chat = cd.findElement(By.id("header-action-item-chat-button"));
chat.click();
Thread.sleep(5000);
}
@Test
public void tc7() throws InterruptedException {
WebElement create = cd.findElement(By.cssSelector("#create-post"));
create.click();
Thread.sleep(7000);
cd.navigate().back();
}
@Test
public void tc8() throws InterruptedException {
WebElement notify = cd.findElement(
By.cssSelector("#mini-inbox-tooltip > span > faceplate-tracker > faceplate-tooltip > button"));
notify.click();
Thread.sleep(7000);
}
@Test
public void tc9() throws InterruptedException {
WebElement dropdown = cd.findElement(By.cssSelector(
"#main-content > div > shreddit-async-loader > div > shreddit-layout-event-setter > shreddit-sort-dropdown"));
dropdown.click();
Thread.sleep(7000);
}
@AfterClass
public void tearDown() {
cd.quit();
}
}