selenium-设置chrome浏览器无界面模式

版权声明:本文为博主原创文章,转载请附上博文链接 https://blog.csdn.net/weixin_44065501/article/details/89094743
# 导入包
from selenium.webdriver.chrome.options import Options


# 设置chrome浏览器无界面模式
chrome_options.add_argument('--headless')
browser = webdriver.Chrome(chrome_options=self.chrome_options)
# 无界面模式下默认不是全屏,所以需要设置一下分辨率
browser.set_window_size(1920, 1080)
 

猜你喜欢

转载自blog.csdn.net/weixin_44065501/article/details/89094743