在python上具有Selenium的PhantomJS 1.8.如何遮挡图片? [英] PhantomJS 1.8 with Selenium on python. How to block images?
本文介绍了在python上具有Selenium的PhantomJS 1.8.如何遮挡图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在Selenium上配置PhantomJS Webdriver使其不加载图像?我知道是否直接使用phantomjs,可以用--load-images=no
启动它,并且它不会加载图像,但是如何通过Selenium和Python配置它呢?
Is there a way to configure PhantomJS webdriver on Selenium to do not load images? I know if I use phantomjs directly, I can start it with --load-images=no
and it won't load the images, but how can I configure that via Selenium and Python?
更新 尝试了以下内容:
UPDATE Tried the following:
args = {
'desired_capabilities': {
'loadImages': False
}
}
driver = webdriver.PhantomJS(**args)
没有成功...
推荐答案
为什么不尝试webdriver.PhantomJS(service_args=['--load-images=no'])
?
这篇关于在python上具有Selenium的PhantomJS 1.8.如何遮挡图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文