Python+Selenium练习(十七)-自定义浏览窗口大小

  设置不同测试场合浏览器窗口大小。

  具体代码:

# coding=utf-8

import time
from selenium import webdriver

driver = webdriver.Chrome()
driver.maximize_window()
driver.get('https://www.baidu.com')
time.sleep(1)
print(driver.get_window_size())

driver.set_window_size(1280,800)
time.sleep(1)
print(driver.get_window_size())

driver.set_window_size(1024,768)
time.sleep(1)
print(driver.get_window_size())

  

参考文章:https://blog.csdn.net/u011541946/article/details/69681153

posted @ 2020-04-05 22:35  哔仙女  阅读(650)  评论(0编辑  收藏  举报