-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample7.java
More file actions
35 lines (29 loc) · 1.39 KB
/
Example7.java
File metadata and controls
35 lines (29 loc) · 1.39 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
package com.SeleniumTestingSamples.Examples;
import java.time.Duration;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
//Element: Button
//Methods - isSelected() and Click()
public class Example7 {
public static void main(String[] args) throws InterruptedException {
WebDriver driver = new ChromeDriver();
String Url = "https://www.leafground.com/button.xhtml;jsessionid=node01eifibwzy1f5bvp5tuiwk09hd7788608.node0";
driver.get(Url);
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10000));
driver.manage().window().maximize();
WebElement getPositionButton = driver.findElement(By.id("j_idt88:j_idt94"));
org.openqa.selenium.Point xypoint = getPositionButton.getLocation();
int xValue = xypoint.getX();
int yValue = xypoint.getY();
System.out.println("X value is: "+xValue+" Y value is: "+yValue);
WebElement colourButton = driver.findElement(By.id("j_idt88:j_idt96"));
String colour = colourButton.getCssValue("background");
System.out.println("Button colour is: "+colour);
WebElement sizeButton = driver.findElement(By.id("j_idt88:j_idt98"));
int height = sizeButton.getSize().getHeight();
int width = sizeButton.getSize().getWidth();
System.out.println("Button Height is: " +height+" Button Width is: "+width);
}
}