java+selenium自动化可视区域大小获取
## js获取窗口大小
#获取网页可见区域大小
client_width=self.driver.execute_script("return document.body.clientWidth")
client_height = self.driver.execute_script("return document.body.clientHeight")
System.out.println(client_height,client_width)
#根据offset获取可见区域大小
client_width = self.driver.execute_script("return document.body.offsetWidth")
client_height = self.driver.execute_script("return document.body.offsetHeight")
System.out.println(client_height,client_width)
# 根据正文全文宽高
client_width = self.driver.execute_script("return document.body.scrollWidth")
client_height = self.driver.execute_script("return document.body.scrollHeight")
System.out.println(client_height, client_width)
# 网页被卷去的宽高
client_width = self.driver.execute_script("return document.body.scrollLeft")
client_height = self.driver.execute_script("return document.body.scrollTop")
System.out.println(client_height, client_width)
# 根据正文部分上左
client_width = self.driver.execute_script("return window.screenLeft")
client_height = self.driver.execute_script("return window.screenTop")
System.out.println(client_height, client_width)
# 根据屏幕分辨率高宽
client_width = self.driver.execute_script("return window.screen.width")
client_height = self.driver.execute_script("return window.screen.height")
System.out.println(client_height, client_width)
# 屏幕可用工作区域高宽
client_width = self.driver.execute_script("return window.screen.availWidth")
client_height = self.driver.execute_script("return window.screen.availHeight")
System.out.println(client_height, client_width)