量角器/硒/茉莉花超时,除非手动启动了webdriver manager

时间:2019-03-19 21:02:12

标签: node.js jasmine protractor

我很难找到这个问题。

环境:

  • Windows Server 2012 R2
  • Chrome:73.0.3683.75
  • 量角器:v5.4.2
  • WebDriver Manager:v12.1.1
  • Chrome Webdriver:v2.46或v73.0.3686.68

工作流程:

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

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

我们升级了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');
    }    

};

1 个答案:

答案 0 :(得分:0)

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

exports.config = {
    directConnect: true
}

希望这可以解决您的问题。