有没有办法为Do not track启用“selenium”选项?使用 chromedriver?
没有command line switches似乎有帮助 this网站说该选项在使用 chromedriver 运行时被禁用,即使我的常规 Chrome 配置文件已打开它。我想使用一个临时配置文件,而不是加载我现有的配置文件。
建议?选项可以自动设置吗?
最佳答案
我想通了。这可以通过设置 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);
关于java - 启用不跟踪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26319535/