Python-Selenium中chromeDriver限制图片和Javascript加载

Posted zhangdingqu的博客

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python-Selenium中chromeDriver限制图片和Javascript加载相关的知识,希望对你有一定的参考价值。

我们有的时候使用Selenium会希望能够限制图片和Javascript执行,从而提高网页加载速度。

 

options=webdriver.ChromeOptions()
prefs={
     profile.default_content_setting_values: {
        images: 2,
        javascript:2
    }
}
options.add_experimental_option(prefs,prefs)
 
browser = webdriver.Chrome(chrome_options=options)
browser.get(http://www.cs/)

 

参考网址:https://blog.csdn.net/karwik/article/details/78573917

 

以上是关于Python-Selenium中chromeDriver限制图片和Javascript加载的主要内容,如果未能解决你的问题,请参考以下文章

Python-Selenium:Chrome 无头设置不适用于“WebDriverWait”

python-selenium-定位一组对象

python-selenium登陆今日头条

python-selenium自动化测试网页

python-selenium自动化测试网页

Python-selenium-自动化测试模型