Selenium2学习-034-WebUI自动化实战实例-032-获取页面 body 大小

获取 body 元素大小的方法,非常简单,直接上码,敬请参阅!

 1     /**
 2      * Get body size
 3      * 
 4      * @author Aaron.ffp
 5      * @version V1.0.0: autoSeleniumDemo main.aaron.sele.core SeleniumCore.java getBrowserBodySize, 2015-8-8 14:12:49 Exp $
 6      * 
 7      * @return int[width,height]
 8      */
 9     public int[] getBrowserBodySize(){
10         // store body size
11         int[] bodySize = new int[2];
12         
13         // get body element
14         WebElement body = this.webdriver.findElement(By.tagName("body"));
15         
16         // get width of body
17         bodySize[0]  = body.getSize().width;
18         
19         // get height of body
20         bodySize[1] = body.getSize().height;
21         
22         return bodySize;
23     }

 

至此,WebUI 自动化功能测试脚本第 032-获取页面 body 大小 顺利完结,希望此文能够给初学 Selenium 的您一份参考。

最后,非常感谢亲的驻足,希望此文能对亲有所帮助。热烈欢迎亲一起探讨,共同进步。非常感谢! ^_^

 

posted @ 2015-08-09 01:28  范丰平  Views(1153)  Comments(0Edit  收藏  举报