-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignment219.java
More file actions
37 lines (24 loc) · 826 Bytes
/
Assignment219.java
File metadata and controls
37 lines (24 loc) · 826 Bytes
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
package TestNGCLAssignments;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Point;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
//WAP to scroll down to about us in amazon?
public class Assignment219 {
@Test
public void ScrollDown() {
ChromeDriver driver = new ChromeDriver();
driver.get("https://www.amazon.in/ref=nav_logo");
driver.manage().window().maximize();
WebElement scrolldown = driver.findElement(By.linkText("About Us"));
Point p = scrolldown.getLocation();
int x = p.getX();
int y = p.getY();
System.out.println(x);
System.out.println(y);
JavascriptExecutor j1 = driver;
j1.executeScript("window.scrollBy(0,2000)"); // to move down ward
}
}