Store width and height of an Image/Element:
int width = driver.findElement(By.id(Value)).getSize().getWidth();
int height = driver.findElement(By.id(Value)).getSize().getHeight();
(or)
System.out.println(driver.findElement(By.id(Value)).getSize());
Store left and top location of an Image/Element:
Point TopLeftlocation =driver.findElement(By.id(Value)).getLocation();
System.out.println(TopLeftlocation.getX() + "\t" + TopLeftlocation.getY());
(or)
Point p = driver.findElement(By.id(Value)).getLocation();
System.out.println("X position:"+p.x);
System.out.println("Y position:"+p.y);
(or)
System.out.println(driver.findElement(By.id(Value)).getLocation());
No comments:
Post a Comment