El selenio obtiene la altura y el ancho naturales de un elemento. No debe confiar en el atributo de estilo. GetSize (), GetLocation () y getRect () no pueden hacerlo
Aquí está el escenario.
Cuando estoy usando GetSize (), GetLocation () Funciona contra la ID de imagen 'FlashID1x' siempre da 250,300, pero la altura y el ancho reales de un elemento es 1 X 1, lo cual es básicamente incorrecto.
Aquí está mi dom objetivo:
<img id="FlashID1x" border="0" width="300" height="250" style="width:300px;height:250px;" alt="" src="http://s2.adform.net/Banners/invisible.gif?bv=2"/>
Aquí está mi código:
System.out.println("total : "+iframe.size());
//driver.switchTo().frame(frame);
org.openqa.selenium.Point point=driver.findElement(By.xpath(".//*[@id='FlashID1x']")).getLocation();
System.out.println("X Position : "+point.x);
System.out.println("Y Position : "+point.y);
System.out.println("X getX : "+point.getX());
System.out.println("Y gety : "+point.getY());
Rectangle pointer=driver.findElement(By.xpath(".//*[@id='FlashID1x']")).getRect();
System.out.println("height : "+pointer.hashCode();
System.out.println(" width : "+pointer.getWidth());
System.out.println("getHeight : "+pointer.getHeight());
System.out.println(" getWidth : "+pointer.getWidth());