1
有没有办法使用chromedriver为selenium启用“Do not track”选项?启用不跟踪
没有一个command line switches似乎有帮助和this网站说,即使我的常规Chrome配置文件打开,使用chromedriver运行时禁用该选项。我想使用一个临时配置文件,但不加载我现有的配置文件。
对此提出建议?该选项是否可以自动设置?
有没有办法使用chromedriver为selenium启用“Do not track”选项?启用不跟踪
没有一个command line switches似乎有帮助和this网站说,即使我的常规Chrome配置文件打开,使用chromedriver运行时禁用该选项。我想使用一个临时配置文件,但不加载我现有的配置文件。
对此提出建议?该选项是否可以自动设置?
我想通了。可以通过设置Chrome preferences file这样的偏好来完成:
Map<String, Object> preferences = new HashMap<String, Object>();
ChromeOptions options = new ChromeOptions();
preferences.put("enable_do_not_track", true);
options.setExperimentalOption("prefs", preferences);