【问题标题】:not able to run protractor test from eclipse on chrome browser无法在 chrome 浏览器上从 eclipse 运行量角器测试
【发布时间】:2016-11-23 22:50:02
【问题描述】:

无法在 chrome 浏览器上从 eclipse 运行量角器测试,但如果我将浏览器更改为 firefox 测试运行良好。

      exports.config = {

allScriptsTimeout : 60000,

suites : {

    LoginTestSuite: 'e2e/TestSuites/Full/LoginTestSuite/*.js',
},    
 capabilities: { 'browserName': 'chrome' },
 directConnect : true,      
baseUrl : 'http://test:8080/',

framework : 'jasmine2',

jasmineNodeOpts : {
    defaultTimeoutInterval : 60000
},
onPrepare : function() {        
    var jasmineReporters = require('jasmine-reporters');
    browser.driver.manage().window().maximize();
    return browser.getProcessedConfig().then(function(config) {
        var browserName = config.capabilities.browserName;
        var junitReporter = new jasmineReporters.JUnitXmlReporter({
            consolidateAll : true,
            savePath : 'tests/test-results',
            filePrefix : browserName + '-xmloutput',
            modifySuiteName : function(generatedSuiteName, suite) {
                return browserName + '.' + generatedSuiteName;
            }
        });
        jasmine.getEnv().addReporter(junitReporter);

        var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');

        var today = new Date(),
        year = today.getFullYear(),
         month = today.getMonth() + 1,
         date = today.getDate(),      
         hh = today.getHours(),
         min = today.getMinutes(),
         timeStamp = year +''+ month+'' + date+'' + hh + min;

        var reporter = new HtmlScreenshotReporter({               
            cleanDestination: false,
            showSummary: true,
            showConfiguration: true,
            showQuickLinks: true,                
            reportTitle: "E2E Report--Test run on" + timeStamp,               
            dest : 'tests/test-results/screenshots',
            filename : 'my-report-'+ timeStamp + '.html',
            captureOnlyFailedSpecs : true,
            pathBuilder : function(currentSpec, suites, browserCapabilities) {

                return browserCapabilities.get('browserName')+'-' +timeStamp + '/' + currentSpec.fullName;
            }
        });
        jasmine.getEnv().addReporter(reporter);
    });
},
resultJsonOutputFile : 'tests/test-results/output.json'
};

我尝试将量角器版本更新到 4.0.11,这使用 chrome 驱动程序版本:2.25 如果我从 eclipse 运行它,我会收到以下错误:

  E/launcher - session not created exception
  from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"8084.1","isDefault":true},"id":1,"name":"","origin":"://"}
  (Session info: chrome=54.0.2840.99)

如果我从命令 npm run e2e-full 运行我的测试,我的测试将在 chrome 浏览器中运行,但从 eclipse 运行它会出错。

此外,如果我在配置文件中将浏览器类型更改为 firefox 并从 eclipse 运行它,测试将运行良好。

不确定在chrome 浏览器中仅从eclipse 运行可能是什么问题会出现此错误。

【问题讨论】:

    标签: eclipse protractor selenium-chromedriver


    【解决方案1】:

    我在更新我的 Google Chrome 版本时遇到了类似的问题。我相信这是量角器的错误。

    我能够通过重新安装量角器和 chrome 驱动程序来解决此问题。我各自的版本:

    Protractor: 4.0.9
    Chromedriver: 2.24
    

    【讨论】:

    • 我升级了使用以下版本并且它工作:Protractor: 4.0.10 Chromedriver: 2.25
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-26
    • 2021-06-06
    • 1970-01-01
    • 1970-01-01
    • 2020-04-02
    • 1970-01-01
    相关资源
    最近更新 更多