Wednesday, 28 August 2013

How to store Left & Top (Location) | Width & Height of an Image/Element using Selenium Webdriver ?

Store width and height of an Image/Element:

int width = driver.findElement(;
int height = driver.findElement(;

Store left and top location of an Image/Element:

Point TopLeftlocation =driver.findElement(;
System.out.println(TopLeftlocation.getX() + "\t" + TopLeftlocation.getY());
Point p = driver.findElement(;
System.out.println("X position:"+p.x);
System.out.println("Y position:"+p.y);

1 comment: