2

我有一个运行 selenium phpunit 测试的 ant 构建脚本。我可以在命令行上运行构建脚本,我看到测试正在进行,浏览器窗口打开并且 selenium 测试已执行。在命令行上一切都很好。

但是,如果我创建一个 jenkins 作业来运行构建脚本。它在尝试运行 phpunit 任务时失败。这是控制台输出。

似乎当詹金斯运行构建时它无法访问硒。请参阅“拒绝访问”“无法显示网页” 任何帮助将不胜感激!

php单元:

 [exec] PHPUnit 3.6.10 by Sebastian Bergmann.
 [exec] 
 [exec] The Xdebug extension is not loaded. No code coverage will be generated.
 [exec] 
 [exec] 
 [exec] E
 [exec] 
 [exec] 
 [exec] Time: 1 second, Memory: 3.75Mb
 [exec] 
 [exec] There was 1 error:
 [exec] 
 [exec] 1) Example::testPokerMainNav
 [exec] Issues while capturing the screenshot:
 [exec] Invalid response while accessing the Selenium Server at 'http://localhost:4444/selenium-server/driver/': <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
 [exec] <HTML>
 [exec]     <HEAD>
 [exec]         <title>Web Page Cannot Be Displayed</title>
 [exec]         <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
 [exec]         <style>
 [exec]         <!--
 [exec] 
 [exec]             body {
 [exec]                 font-family: Arial,Sans-serif;
 [exec]             }
 [exec] 
 [exec]             li {
 [exec]                 padding-top: 5px;
 [exec]             }
 [exec] 
 [exec]             .messageBox {
 [exec]                 BORDER-TOP: #9c9a9c 1px solid;
 [exec]                 BORDER-LEFT: #9c9a9c 1px solid;
 [exec]                 BORDER-RIGHT: #9c9a9c 1px solid;
 [exec]                 BORDER-BOTTOM: #9c9a9c 1px solid;
 [exec]             }
 [exec] 
 [exec]             .alertTitle
 [exec]             {
 [exec]                 color: #676767;
 [exec]                 FONT-SIZE: 12px;
 [exec]                 font-weight: bold;
 [exec]             }
 [exec] 
 [exec]             .alertText
 [exec]             {
 [exec]                 color: #676767;
 [exec]                 FONT-SIZE: 11px;
 [exec]                 font-weight: normal;
 [exec]                 padding-left: 15px;
 [exec]                 padding-right: 15px;
 [exec]             }
 [exec] 
 [exec]         -->
 [exec]         </style>
 [exec]     </HEAD>
 [exec]     <body>
 [exec]         <table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0">
 [exec]             <tr>
 [exec]                 <td align="center" valign="center">
 [exec]                     <table>
 [exec]                         <tr>
 [exec]                             <td>
 [exec]                                 <table border="0" class="messageBox">
 [exec]                                     <tr>
 [exec]                                         <td height="25">&nbsp;</td>
 [exec]                                     </tr>
 [exec]                                     <tr>
 [exec]                                         <td align="center">
 [exec]                                             <table border="0" width="490">
 [exec]                                                 <tr>
 [exec]                                                     <td class="alertTitle" align="center">
 [exec]                                                         <strong>Unable to display page</strong>
 [exec]                                                     </td>
 [exec]                                                 </tr>
 [exec]                                                 <tr class="spacerRow">
 [exec]                                                     <td></td>
 [exec]                                                 </tr>
 [exec]                                                 <tr>
 [exec]                                                     <td class="alertText" align="left">
 [exec]                                                         It has not been possible to display the page you requested for the following reason:
 [exec]                                                         <ul>
 [exec]                                                             <li>Access Denied</li>
 [exec]                                                         </ul>
 [exec]                                                         Contact your system administrator if you continue to experience difficulties.
 [exec]                                                     </td>
 [exec]                                                 </tr>
 [exec]                                             </table>
 [exec]                                         </td>
 [exec]                                     </tr>
 [exec]                                     <tr>
 [exec]                                         <td height="25">&nbsp;</td>
 [exec]                                     </tr>
 [exec]                                 </table>
 [exec]                             </td>
 [exec]                         </tr>
 [exec]                         <tr>
 [exec]                             <td align="right"><asp:Label id="lblDateTime" runat="server" CssClass="AlertText" /></td>
 [exec]                         </tr>
 [exec]                     </table>
 [exec]                 </td>
 [exec]             </tr>
 [exec]         </table>
 [exec]     </body>
 [exec] </HTML>
 [exec] 
 [exec] Invalid response while accessing the Selenium Server at 'http://localhost:4444/selenium-server/driver/': <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
 [exec] <HTML>
 [exec]     <HEAD>
 [exec]         <title>Web Page Cannot Be Displayed</title>
 [exec]         <meta name="vs_targetSchema" content="

构建失败

硒:selenium-server-standalone-2.21.0.jar。

从 Firebug selenium IDE 导出的 PHPunits 测试。

PHPUnit:3.6.10。

4

1 回答 1

0

http_proxy在ubuntu中设置了环境文件。

出于某种原因,jenkins 用户试图通过代理连接到我的网站。然而,该网站与詹金斯在同一个盒子上。因此失败。

我删除了http_proxy,重新启动了 ubuntu 并且它工作了。

仍然令人费解,但它现在正在工作。

于 2012-09-28T12:57:20.623 回答