我正在使用自签名的数字签名证书签署 PDF,并且我正在寻找一种方法来添加keyUsage(链接)我找到了这篇文章,并相应地更改了我的 openssl.cnf。
req_extensions = v3_req
[ v3_req ]
basicConstraints = CA:TRUE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment,dataEncipherment
我正在使用下一个代码对数字签名进行自签名:
openssl genrsa -des3 -passout pass:1234 -out aaa.private.pem -extensions v3_req
openssl req -passout pass:1234 -subj "/C=IL/ST= - /L=/O=/CN=AB" -utf8 -key aaa.private.pem -passin pass:1234 -new > aaa.cert. csr -extensions v3_req
openssl rsa -in aaa.private.pem -passin pass:1234 -out aaa.key
openssl x509 -req -days 3650 -in aaa.cert.csr -out aaa.cert -signkey aaa.key -CA myCA.ca.cert -CAkey myCA.ca.key -CAcreateserial -extensions v3_req
openssl pkcs12 …
我正在使用带有selenium-webdriver包的Node.js 来运行我的测试.
每次测试开始时,Web驱动程序都会启动一个新会话并打开一个新窗口.
我正在尝试获取会话ID并在以后使用它getSession()
(doc referance link)
var webdriver = require('selenium-webdriver');
var SeleniumServer = require('selenium-webdriver/remote').SeleniumServer;
var server = new SeleniumServer('./seleniumServer/selenium-server-standalone-2.43.1.jar', {
port: 4444
});
server.start();
var driver = new webdriver.Builder()
.usingServer(server.address())
.withCapabilities(webdriver.Capabilities.firefox())
.build();
console.log(driver.getSession());
Run Code Online (Sandbox Code Playgroud)
但这会导致异常:
getSession();
^
TypeError: Object [object Object] has no method 'getSession'
at Object.<anonymous> (\testing\demo_1.js:14:3)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
Run Code Online (Sandbox Code Playgroud)
任何人都可以告诉我它有什么问题以及如何获得并设置selenium会话ID?
最重要的是,如何使用sessionId附加到打开的浏览器会话?
我正在运行无头镀铬测试,其中一部分我想阻止浏览器加载页面上的图像,页面必须是数据网址而不是普通网页.
我在下一个启动命令中使用无头chrome:
chrome --headless --remote-debugging-port=9222
我创建了下一个测试来演示我想要实现的目标.但没有任何作用......
const CDP = require('chrome-remote-interface');
const fs = require('fs');
CDP(async(client) => {
const {
Page,
Network
} = client;
try {
await Page.enable();
await Network.enable();
await Network.emulateNetworkConditions({
offline: true,
latency: 0,
downloadThroughput: 0,
uploadThroughput: 0
});
await Page.navigate({
url: "data:text/html,<h1>The next image should not be loaded</h1><img src='http://via.placeholder.com/350x150'>"
});
await Page.loadEventFired();
const {
data
} = await Page.captureScreenshot();
fs.writeFileSync((+new Date()) + '.png', Buffer.from(data, 'base64'));
} catch (err) {
console.error(err);
} finally {
await client.close();
}
}).on('error', …Run Code Online (Sandbox Code Playgroud)