如何在 Chrome 驱动程序 Selenium Python 中禁用 java 脚本 [英] How to disable java script in Chrome Driver Selenium Python

查看:30
本文介绍了如何在 Chrome 驱动程序 Selenium Python 中禁用 java 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 python 在 Selenium 的 Chrome 驱动程序中禁用 Java 脚本

How can I disable Java Script in Selenium's Chrome Driver using python

推荐答案

真的很难.您可以尝试这样做:

It's really difficult. You can try doing this way:

DesiredCapabilities caps = DesiredCapabilities.chrome();
caps.setCapability("chrome.switches", Arrays.asList("--disable-javascript"));

但正如 here 所写,如果您使用 ChromeDriver2,则无法禁用 JavaScript.

But as it is written here, you can´t disable JavaScript if you use ChromeDriver2.

这篇关于如何在 Chrome 驱动程序 Selenium Python 中禁用 java 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆