2

使用 phantomjs com.codeborne:phantomjsdriver:1.2.1、selenium 2.49 和 browserMob 代理 browsermob-proxy-2.0-beta-9。在 Mac 上测试工作正常。使用正确的可执行文件在 Linux 64 位上测试相同的设置(功能)会遇到以下消息。使用 HTTPS 的 URL 会发生这种情况。

[INFO  - 2016-02-15T19:45:00.917Z] GhostDriver - Main - running on port 1548
[INFO  - 2016-02-15T19:45:00.971Z] Session [99d42c60-d41c-11e5-bf2d-2b2a3425f04c] - page.settings - {"XSSAuditingEnabled":false,"javascriptCanCloseWindows":true,"javascriptCanOpenWindows":true,"javascriptEnabled":true,"loadImages":true,"localToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.1.1 Safari/538.1","webSecurityEnabled":false}
[INFO  - 2016-02-15T19:45:00.975Z] Session [99d42c60-d41c-11e5-bf2d-2b2a3425f04c] - page.customHeaders:  - {}
[INFO  - 2016-02-15T19:45:00.975Z] Session [99d42c60-d41c-11e5-bf2d-2b2a3425f04c] - Session.negotiatedCapabilities - {"browserName":"phantomjs","version":"2.1.1","driverName":"ghostdriver","driverVersion":"1.2.0","platform":"linux-unknown-64bit","javascriptEnabled":true,"takesScreenshot":false,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyAutoconfigUrl":null,"autodetect":false,"socksUsername":null,"socksPassword":null,"httpProxy":"54.86.251.172:13007","proxyType":"MANUAL","noProxy":null,"ftpProxy":"54.86.251.172:13007","socksProxy":null,"hCode":437462540,"class":"org.openqa.selenium.Proxy","sslProxy":"54.86.251.172:13007"}}
[INFO  - 2016-02-15T19:45:00.975Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: 99d42c60-d41c-11e5-bf2d-2b2a3425f04c
[INFO  - 2016-02-15T19:45:07.273Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-up phase starting NOW
[INFO  - 2016-02-15T19:47:02.432Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-up phase starting NOW
[INFO  - 2016-02-15T19:49:00.725Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-up phase starting NOW
[INFO  - 2016-02-15T19:49:01.464Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-up phase starting NOW

当我查看该过程时,它显示为

tomcat7   5685  0.8  0.3 1372232 23692 ?       Sl   19:26   0:19 /phantomjs-2.1.1-linux-x86_64/bin/phantomjs --proxy-type=http --proxy=54.86.251.172:13009 --web-security=no --ssl-protocol=tlsv1 --ignore-ssl-errors=yes --webdriver=20785 --webdriver-logfile=/var/lib/tomcat7/phantomjsdriver.log

这里的建议对我不起作用。

PhantomJS 挂了很长时间说“异步会话清理阶段现在开始”

重复“现在开始的异步会话清理阶段”

以下是能力

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setJavascriptEnabled(true);
capabilities.setCapability("takesScreenshot", false);
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, new String[] {"--web-security=no", "--ssl-protocol=any", "--ignore-ssl-errors=yes"});
capabilities.setCapability("phantomjs.binary.path", this.phantomjsPath);

WebDriver webDriver = new PhantomJSDriver(capabilities);

对于带有 HTTP 的 url,它会通过,但是我希望捕获的 HAR 始终是空的。

{"log":{"creator":{"name":"BrowserMob Proxy","comment":"","version":"2.0"},"entries":[],"pages":[{"startedDateTime":"2016-02-15T21:58:00.996+0000","pageTimings":{"comment":""},"comment":"","id":"Page 1","title":""}],"comment":"","version":"1.2"}}

请不要将此问题视为重复问题,因为我已经查看并尝试了其他类似问题的建议,但没有一个有效。将有助于了解正在发生的事情以及如何解决这个问题。

4

0 回答 0