forked from ortoniKC/Selenium-WebDriver-Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButtons.java
More file actions
48 lines (29 loc) · 1.05 KB
/
Copy pathButtons.java
File metadata and controls
48 lines (29 loc) · 1.05 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
package chapter6;
import org.openqa.selenium.Point;
import org.openqa.selenium.Rectangle;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class Buttons {
public static void main(String[] args) {
ChromeDriver driver = new ChromeDriver();
driver.get("https://letcode.in/");
driver.manage().window().maximize();
driver.get("https://letcode.in/buttons");
// location
WebElement btn1 = driver.findElementById("position");
Point location = btn1.getLocation();
System.out.println(location);
// color
WebElement btn2 = driver.findElementById("color");
String color = btn2.getCssValue("background-color");
System.out.println(color);
// width & height
Rectangle rect = driver.findElementById("property").getRect();
int height = rect.getHeight();
int width = rect.getWidth();
System.out.println("Tall "+ height + " Fat "+width);
boolean enabled = driver.findElementById("isDisabled").isEnabled();
System.out.println(enabled);
driver.quit();
}
}