【问题标题】:Protractor/Selenium/Jasmine timeout unless webdriver manager is started manuallyProtractor/Selenium/Jasmine 超时,除非手动启动 webdriver 管理器
【发布时间】:2019-03-19 21:02:12
【问题描述】:

我很难追查这个问题。

环境:

  • Windows Server 2012 R2
  • 铬:73.0.3683.75
  • 量角器:v5.4.2
  • WebDriver 管理器:v12.1.1
  • Chrome 网络驱动程序:v2.46 或 v73.0.3686.68

工作流程:

  • 从 TeamCity 启动的测试套件
  • TeamCity 启动远程 powershell 脚本以在目标系统上启动量角器
  • 目标系统上的脚本运行protractor protractor.conf.js

在 Chrome 自动更新到版本 73.xxx 之前,一切正常。您的浏览器将启动并且测试将运行。安装 Chrome 73 后,jasmine 无法得到浏览器的响应。

我们升级了 Web 驱动程序以匹配 Chrome 73 记录的支持版本。Jasmine 仍然未能得到响应。有什么方法可以解决为什么我们收到“从渲染中接收消息超时”错误?

可能的线索:如果您从命令行以交互方式运行量角器,则测试有效。

这是我们测试的输出,包括错误:

[21:10:51][Step 2/4]       A-   First test.... 
[21:10:51][Step 2/4]         - Failed: timeout: Timed out receiving message from renderer: 600.000


[21:11:34][Step 2/4] protractor : (node:6836) UnhandledPromiseRejectionWarning: WebDriverError: No active session with ID 
[21:11:34][Step 2/4] 0a7594e8b0c09966cd91bd158b4ba1e9
[21:11:34][Step 2/4] At C:\webenrollmentautomation\Automation\WebEnroll.ps1:58 char:3
[21:11:34][Step 2/4] +         protractor protractor.conf.js --params.machine  $machine 2>&1 ...
[21:11:34][Step 2/4] +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[21:11:34][Step 2/4]     + CategoryInfo          : NotSpecified: ((node:6836) Unh...d91bd158b4ba1e9:String) [], RemoteException
[21:11:34][Step 2/4]     + FullyQualifiedErrorId : NativeCommandError
[21:11:34][Step 2/4]  
[21:11:34][Step 2/4]     at Object.checkLegacyResponse 
[21:11:34][Step 2/4] (C:\Users\identix\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\error.js:546:15)
[21:11:34][Step 2/4]     at parseHttpResponse 
[21:11:34][Step 2/4] (C:\Users\identix\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\http.js:509:13)
[21:11:34][Step 2/4]     at doSend.then.response 
[21:11:34][Step 2/4] (C:\Users\identix\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\http.js:441:30)
[21:11:34][Step 2/4]     at <anonymous>
[21:11:34][Step 2/4]     at process._tickCallback (internal/process/next_tick.js:189:7)
[21:11:34][Step 2/4] (node:6836) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing 

protractor.conf.js 的内容:

exports.config = {
    framework: 'jasmine',
    jasmineNodeOpts: {
        showColors: true, // Use colors in the command line report.
        includeStackTrace: true,
        defaultTimeoutInterval: 1440000
    },    
    multiCapabilities: {
        browserName: 'chrome',
        chromeOptions: {
            prefs: {
                'profile.managed_default_content_settings.notifications': 2
            }
        },
        ignoreProtectedModeSettings: true
    },    

    // },
    specs: [
       // specs listed here
    ],

    params: {
        // params listed here
    },

    /

    resultJsonOutputFile:'./my.json',

    SELENIUM_PROMISE_MANAGER: false,

    onPrepare: async() => {
    //browser.manage().timeouts().implicitlyWait(5000);
        browser.ignoreSynchronization = true;
        var jasmineReporters = require('jasmine-reporters');
        jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
            consolidateAll: true,
            savePath: 'testresults',
            filePrefix: 'xmloutput'
        }));

        require('ts-node').register({
            project: require('path').join(__dirname, './tsconfig.e2e.json')
        });
        var SpecReporter = require('jasmine-spec-reporter').SpecReporter;
        jasmine.getEnv().addReporter(new SpecReporter({
            spec: {
                displayStacktrace: true,
                // displayDuration: true,
                // displayFailed: true,
                // displayPending: true,
                // displaySuccessful: true
            }
        }));
    },

    afterLaunch: async() => {
        var reporter = require('protractor-multicapabilities-htmlreporter');
        reporter.generateHtmlReport('./my.json','Automation Results','./report.html');
    }    

};

【问题讨论】:

    标签: node.js jasmine protractor


    【解决方案1】:

    尝试将以下内容添加到您的配置中

    exports.config = {
        directConnect: true
    }
    

    希望这能解决您的问题。

    【讨论】:

      猜你喜欢
      • 2015-05-14
      • 1970-01-01
      • 2018-04-24
      • 2014-09-15
      • 2014-12-31
      • 1970-01-01
      • 2016-03-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多