我想使用无头铬头进行硒的自动化测试.(https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md)
我确实已经在9222上运行了无头版本.所以如果我打开http://10.252.100.33:9222/json/我确实得到了
[ {
"description": "",
"devtoolsFrontendUrl": "/devtools/inspector.html?ws=127.0.0.1:9223/devtools/page/0261be06-1271-485b-bdff-48e443de7a91",
"id": "0261be06-1271-485b-bdff-48e443de7a91",
"title": "The Chromium Projects",
"type": "page",
"url": "https://www.chromium.org/",
"webSocketDebuggerUrl": "ws://127.0.0.1:9223/devtools/page/0261be06-1271-485b-bdff-48e443de7a91"
} ]
Run Code Online (Sandbox Code Playgroud)
作为下一步,我想将硒连接到无头铬上.但是,当我尝试
final DesiredCapabilities caps = DesiredCapabilities.chrome();
final WebDriver driver = new RemoteWebDriver(new URL("http://localhost:9222/json"), caps);
driver.get("http://www.google.com");
Run Code Online (Sandbox Code Playgroud)
我确实得到以下注销
Jän 24, 2017 7:14:45 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFORMATION: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
Jän 24, 2017 7:14:45 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFORMATION: Falling back to original OSS JSON Wire Protocol.
Jän 24, …Run Code Online (Sandbox Code Playgroud) 我目前正在使用 GCE 容器虚拟机(不是 GKE)来运行 Docker 容器,这些容器将其 JSON 格式的日志写入控制台。日志信息会自动收集并存储在 Stackdriver 中。
问题:Stackdriver 将data-field显示jsonPayload为文本 - 而不是 JSON。看起来有效负载中字段的引号被转义,因此不被识别为 JSON 结构。
我同时使用了 logback-classic(就像这里解释的那样)和 slf4j/log4j(使用 JSONPattern)来生成 JSON 输出(看起来不错),但是输出没有正确解析。
我假设,我必须在某处配置输出是 JSON 结构的,而不是纯文本。到目前为止,我还没有找到在使用容器 VM 时执行此操作的选项。