selenium-webdriver - SELENIUM - 浏览器在使用代理和所需功能时以不安全模式启动
问题描述
// start the proxy
BrowserMobProxy proxy = new BrowserMobProxyServer();
proxy.start(0);
// get the Selenium proxy object
Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);
// configure it as a desired capability
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.PROXY, seleniumProxy);
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
// start the browser up
@SuppressWarnings("deprecation")
WebDriver driver = new ChromeDriver(capabilities);
// enable more detailed HAR capture, if desired (see CaptureType for the
// complete list)
proxy.enableHarCaptureTypes(CaptureType.REQUEST_BINARY_CONTENT, CaptureType.REQUEST_HEADERS,
CaptureType.REQUEST_CONTENT, CaptureType.REQUEST_COOKIES, CaptureType.RESPONSE_BINARY_CONTENT,
CaptureType.RESPONSE_CONTENT, CaptureType.RESPONSE_HEADERS, CaptureType.RESPONSE_COOKIES);
// create a new HAR with the label
proxy.newHar("google");
// open website
driver.get("https://www.google.co.in");
您能否建议如何以安全模式启动浏览器,即使在使用 ACCEPT_SSL_CERTS 作为 True 之后它也无法正常工作
解决方案
推荐阅读
- java - 在主题的特定分区中发送消息
- r - 如何执行以下任务
- python-3.x - 在python 3中使用\ b而不删除一个字符
- machine-learning - IndexError:索引 13 超出轴 1 的范围,大小为 1
- php - 如何按出生日期获得本月的退休金
- python - 使用 place 方法而不是网格时不会创建条目小部件,也不会创建任何错误
- javascript - 如何自动创建包含日期的便笺?
- python - python xlwings模块错误:OSError:[WinError -2147467259]未指定错误
- azure - azure devops 管道 CopyFiles@2 任务从代理 A 复制文件,但 DownloadBuildArtifacts@0 将文件下载到代理 B
- vue.js - 如何在 Vue 项目中正确构建组件?