在tomcat上找不到PhantomJS页面

时间:2015-05-29 15:09:34

标签: java spring selenium phantomjs

我正在为Spring MVC中的Glassfish上的tomcat上的应用程序编写自动化测试。

当我测试应用程序时,一切正常,但当我想连接到旁边的应用程序时,它会得到404

示例:

Glassfish,它是我的应用程序 127.0.0.1:8080/webpage

Tomcat的: 127.0.0.1:9206/site

日志:

Info:   executable: */bin/phantomjs
Info:   port: 5223
Info:   arguments: [--ignore-ssl-errors=true, --webdriver=5223, --webdriver-logfile=*/phantomjsdriver.log]
Info:   environment: {}
Severe:   [INFO  - 2015-05-29T14:57:15.628Z] GhostDriver - Main - running on port 5223
Severe:   [INFO  - 2015-05-29T14:57:15.721Z] Session [feb4d4f0-0612-11e5-a39c-15224a5e9e7b] - page.settings - {"XSSAuditingEnabled":false,"javascriptCanCloseWindows":true,"javascriptCanOpenWindows":true,"javascriptEnabled":true,"loadImages":true,"localToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0 (Unknown; Linux i686) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.0.0 Safari/538.1","webSecurityEnabled":true}
Severe:   [INFO  - 2015-05-29T14:57:15.721Z] Session [feb4d4f0-0612-11e5-a39c-15224a5e9e7b] - page.customHeaders:  - {}
Severe:   [INFO  - 2015-05-29T14:57:15.722Z] Session [feb4d4f0-0612-11e5-a39c-15224a5e9e7b] - Session.negotiatedCapabilities - {"browserName":"phantomjs","version":"2.0.0","driverName":"ghostdriver","driverVersion":"1.2.0","platform":"linux-unknown-32bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"}}
Severe:   [INFO  - 2015-05-29T14:57:15.722Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: feb4d4f0-0612-11e5-a39c-15224a5e9e7b
Info:   <!DOCTYPE html><html lang="en"><head>
  <meta charset="utf-8">
  <title>404 error</title>
</head>
<body>
<h1>Page not found!!!</h1>
<p>The page you requested was not found in this site.</p>
</body></html>

功能:

    DesiredCapabilities caps = new DesiredCapabilities();

    caps.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, new String[]{"--ssl-protocol=any"});
    caps.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, new String[]{"--web-security=false"});
    caps.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, new String[]{"--ignore-ssl-errors=true"});
    caps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, ConfigUrls.PHANTOMJS_HOME);
    caps.setCapability("page.settings.loadImages", false);
    caps.setCapability("trustAllSSLCertificates", true);
    caps.setJavascriptEnabled(true);

    driver = new PhantomJSDriver(caps);

0 个答案:

没有答案