Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/jenkins/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
错误[严重]:在Jenkins上通过Selenium执行testsuite时,从呈现程序接收消息时超时:20.000_Selenium_Jenkins_Selenium Webdriver_Continuous Integration_Selenium Chromedriver - Fatal编程技术网

错误[严重]:在Jenkins上通过Selenium执行testsuite时,从呈现程序接收消息时超时:20.000

错误[严重]:在Jenkins上通过Selenium执行testsuite时,从呈现程序接收消息时超时:20.000,selenium,jenkins,selenium-webdriver,continuous-integration,selenium-chromedriver,Selenium,Jenkins,Selenium Webdriver,Continuous Integration,Selenium Chromedriver,我使用ChromeDriver和Selenium来运行自动测试。测试套件在Eclipse和命令行中都成功运行。然而,当我试图在Jenkins中构建它时,它并没有运行 这是我在Jenkins的工作配置(所有信息的名称都经过了保密处理): 我可以确认Ant正在运行JDK8 这是生成的控制台输出: [junit] Running main.TESTNAME [junit] Starting ChromeDriver 2.33.506120 (e3e53437346286c0bc2d2dc9aa

我使用ChromeDriver和Selenium来运行自动测试。测试套件在Eclipse和命令行中都成功运行。然而,当我试图在Jenkins中构建它时,它并没有运行

这是我在Jenkins的工作配置(所有信息的名称都经过了保密处理): 我可以确认Ant正在运行JDK8

这是生成的控制台输出:

[junit] Running main.TESTNAME
    [junit] Starting ChromeDriver 2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f) on port 27352
    [junit] Only local connections are allowed.
    [junit] Apr 26, 2018 3:52:34 PM org.openqa.selenium.remote.ProtocolHandshake createSession
    [junit] INFO: Detected dialect: OSS
    [junit] Running through test suite as:
    [junit] User: USERNAME
    [junit] URL: CONFIDENTIAL
    [junit] [30.168][SEVERE]: Timed out receiving message from renderer: 20.000
    [junit] [30.170][SEVERE]: Timed out receiving message from renderer: -0.003
    [junit] Total number of tests ran for TESTNAME: 5, Number of tests failures: 4, Number of tests ignored: 0
    [junit] testViewProfileDetailsButtonAndBrowseBack(test.TESTNAME): timeout
    [junit]   (Session info: chrome=64.0.3282.119)
    [junit]   (Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 10.0.14393 x86_64) (WARNING: The server did not provide any stacktrace information)
    [junit] Command duration or timeout: 0 milliseconds
    [junit] Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:14.666Z'
    [junit] System info: host: 'PC', ip: 'IP', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_151'
    [junit] Driver info: org.openqa.selenium.chrome.ChromeDriver
    [junit] Capabilities {acceptSslCerts: true, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.33.506120 (e3e53437346286..., userDataDir: C:\WINDOWS\TEMP\scoped_dir1...}, cssSelectorsEnabled: true, databaseEnabled: false, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 64.0.3282.119, webStorageEnabled: true}
下面我的
build.xml
大部分是自动生成的,除了我添加JUnit集成的末尾:

<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="build" name="PROJECTSeleniumTest">
<property environment="env"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.8"/>
<property name="source" value="1.8"/>
<path id="PROJECTSeleniumTest.classpath">
    <pathelement location="bin"/>
    <pathelement location="lib/byte-buddy-1.7.5.jar"/>
    <pathelement location="lib/client-combined-3.8.1-sources.jar"/>
    <pathelement location="lib/client-combined-3.8.1.jar"/>
    <pathelement location="lib/commons-codec-1.10.jar"/>
    <pathelement location="lib/commons-exec-1.3.jar"/>
    <pathelement location="lib/commons-logging-1.2.jar"/>
    <pathelement location="lib/gson-2.8.2.jar"/>
    <pathelement location="lib/guava-23.0.jar"/>
    <pathelement location="lib/hamcrest-core-1.3.jar"/>
    <pathelement location="lib/httpclient-4.5.3.jar"/>
    <pathelement location="lib/httpcore-4.4.6.jar"/>
    <pathelement location="lib/junit-4.12.jar"/>
</path>
<target name="init">
    <mkdir dir="bin"/>
    <copy includeemptydirs="false" todir="bin">
        <fileset dir="src">
            <exclude name="**/*.launch"/>
            <exclude name="**/*.java"/>
        </fileset>
    </copy>
</target>
<target name="clean">
    <delete dir="bin"/>
</target>
<target depends="clean" name="cleanall"/>
<target depends="build-subprojects,build-project,junit" name="build"/>
<target name="build-subprojects"/>
<target depends="init" name="build-project">
    <echo message="${ant.project.name}: ${ant.file}"/>
    <javac debug="true" debuglevel="${debuglevel}" destdir="bin" includeantruntime="false" source="${source}" target="${target}">
        <src path="src"/>
        <classpath refid="PROJECTSeleniumTest.classpath"/>
    </javac>
</target>

<target name="create_directory">
    <echo message="Create the directory JenkinsTestReports\" />
    <mkdir dir="JenkinsTestReports" />
</target>   

<target name="junit" depends="create_directory">
    <echo message="${java.version}"/>
    <junit printsummary="yes" fork="yes" haltonfailure="yes">
        <classpath>
            <path refid="PROJECTSeleniumTest.classpath" />
            <pathelement location="${basedir}\bin"/>
        </classpath>
        <batchtest todir="JenkinsTestReports" fork="true">
          <fileset dir="${basedir}\bin">
            <include name="main\TESTNAME.class"/>
          </fileset>
        </batchtest>
        <formatter type="xml"/>
        <formatter type="plain"/>
    </junit>
</target>

有人知道原因是什么吗?谢谢。

此错误消息

[30.168][SEVERE]: Timed out receiving message from renderer: 20.000
…意味着ChromeDriver无法启动新的Chrome浏览器进程

您的主要问题是所使用的二进制文件之间的版本兼容性,如下所示:

  • 您使用的是chromedriver=2.33
  • 的发行说明明确提到以下内容:
支持Chrome v60-62

  • 您正在使用chrome=64.0
  • 的发行说明明确提到以下内容:
支持Chrome v62-64(包括您正在使用的浏览器版本)

  • 您的Selenium客户端版本是3.8.1
  • 您的JDK版本是1.8.0_151,它相当旧
因此,JDK v8u151、Selenium客户端v3.8.1、ChromeDriver v2.33和Chrome浏览器v64.0之间存在明显的不匹配

解决方案
  • 将JDK升级到最新级别
  • 将硒升级到当前水平
  • 将ChromeDriver升级到当前级别
  • 将Chrome版本保持在Chrome v66.x的级别。()
  • 通过IDE清理项目工作区,并仅使用所需的依赖项重建项目
  • 在执行测试套件之前和之后,使用该工具清除所有操作系统杂务
  • 如果您的基本Web客户端版本太旧,请通过卸载它并安装最新的GA和Web客户端发布版本
  • 重新启动系统
  • 执行
    @测试

    • 删除超时为我解决了这个问题:

      driver.manage().timeouts().implicitlyWait
      driver.manage().timeouts().pageLoadTimeout
      driver.manage().timeouts().setScriptTimeout
      


      由于我的工作场所限制了我的Chrome版本控制,我现在无法将其升级到v64以上。我也不能安装未经批准的软件。然而,我确实更新了:ChromeDriver到2.37(支持ChromeV64),Selenium到3.11,jobs JDK到1.8.0_171。它仍然没有成功运行。正如我所说,在更新这些命令行和Eclipse之前,我的ant构建可以在命令行和Eclipse中工作。只是和詹金斯不相容。如果我有证据证明它在其他地方执行,你认为它仍然与版本不兼容吗?它们在不同的小版本中运行,但仍然是1.8
      //driver.manage().timeouts().implicitlyWait(2000, TimeUnit.MILLISECONDS);
      //driver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS);
      //driver.manage().timeouts().setScriptTimeout(60, TimeUnit.SECONDS);