我想使用无头的chromedriver而不是phantomjs。对于phantomjs,我能够提供ssl证书和密钥路径作为命令行参数。如下。如何为无头chromedriver提供证书和密钥路径作为命令行参数?
ImmutableMap<String, String> commandLineArguments = ImmutableMap.<String, String>builder()
.put("ssl-protocol", "any")
.put("ssl-client-certificate-file", certificatePath)
.put("ssl-client-key-file", certificateKeyPath)
.put("ssl-client-key-passphrase", "webpass").build();
String[] params = commandLineArguments.entrySet().stream()
.map(e -> String.format("--%s=%s", e.getKey(), e.getValue()))
.collect(Collectors.toList())
.toArray(new String[0]);
cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
cap.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, params);
答案 0 :(得分:1)
let obj = { "Ann": true, "Billy": false, "Cat": false, "David": true }
let count = Object.values(obj).reduce((op,inp) => op + inp , 0)
console.log(count)
您也可以通过这种方式在无头模式下运行chrome。