使用量角器和黄瓜运行多个实例时出错

时间:2019-03-08 13:51:20

标签: selenium selenium-webdriver protractor cucumber selenium-chromedriver

我是黄瓜和量角器的自动化测试用户,我对配置多功能有疑问。

count大于10时,我看到以下错误,但仅在Linux环境中。我可以设置计数> 10个窗口而没有问题。

config.js

const path = require("path");
const jsonReports = process.cwd() + "/reports/json";
const Reporter = require("../support/reporter_login2/reporter");

exports.config = {
    ignoreUncaughtExceptions: true,
    seleniumAddress: ,
    getPageTimeout: 60000,
    maxSessions: 60,
    allScriptsTimeout: 500000,
    multiCapabilities: [{
        // 5 chrome sessions will start, each running 1 spec file at a time, until all 10 finish
        browserName: 'chrome',
        shardTestFiles: true,
        maxInstances: 20,
        count: 15,
        client_key: "api_key",
        client_secret: "api_secret"
    }],

    /*capabilities: {
      browserName: process.env.TEST_BROWSER_NAME || "chrome",
      'chromeOptions': {
       //'args': ['--user-data-dir=~/.e2e-chrome-profile'],
        'args': ['--disable-web-security', '--user-data-dir=~/.e2e-chrome-profile']
      }
    },*/
    framework: "custom",
    frameworkPath: require.resolve("protractor-cucumber-framework"),
    specs: ["../features/login2/*.feature"],
    // resultJsonOutputFile: "./reports/json/protractor_report.json",
    onPrepare: function () {
        var chai = require('chai');
        chaiAsPromised = require('chai-as-promised');
        chai.use(chaiAsPromised);
        chai.should();
        global.expect = chai.expect;
        browser.ignoreSynchronization = true;
        browser.manage().window().maximize();
        require('babel-register');
        Reporter.createDirectory(jsonReports);
    },
    cucumberOpts: {
        //strict: true,
        format: 'json:./reports/json/cucumber_report.json',
        require: ["../stepDefinitions/login2/*.js"],
        tags: "(@login2_1Step1)"
        //@manualTask1Step1 or @manualTask1Step2 or 
    },
    onComplete: function () {
        Reporter.createHTMLReport();
    }
};

错误

✖ And I want to click the Create Button # ../stepDefinitions/login2/feat1_stepUno.js:183
[chrome #21]        StaleElementReferenceError: stale element reference: element is not attached to the page document
[chrome #21]          (Session info: chrome=72.0.3626.119)
[chrome #21]          (Driver info: chromedriver=2.46.628388 (4a34a70827ac54148e092aafb70504c4ea7ae926),platform=Linux 3.10.0-957.5.1.el7.x86_64 x86_64)
[chrome #21]            at Object.checkLegacyResponse (/opt/perform/.nvm/versions/node/v8.0.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:546:15)
[chrome #21]            at parseHttpResponse (/opt/perform/.nvm/versions/node/v8.0.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:509:13)
[chrome #21]            at doSend.then.response (/opt/perform/.nvm/versions/node/v8.0.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:441:30)
[chrome #21]            at <anonymous>
[chrome #21]            at process._tickCallback (internal/process/next_tick.js:169:7)
[chrome #21]        From: Task: WebElement.getText()
[chrome #21]            at thenableWebDriverProxy.schedule (/opt/perform/.nvm/versions/node/v8.0.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:807:17)
[chrome #21]            at WebElement.schedule_ (/opt/perform/.nvm/versions/node/v8.0.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:2010:25)
[chrome #21]            at WebElement.getText (/opt/perform/.nvm/versions/node/v8.0.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:2277:17)
[chrome #21]            at actionFn (/opt/perform/.nvm/versions/node/v8.0.0/lib/node_modules/protractor/built/element.js:89:44)
[chrome #21]            at Array.map (native)
[chrome #21]            at actionResults.getWebElements.then (/opt/perform/.nvm/versions/node/v8.0.0/lib/node_modules/protractor/built/element.js:461:65)
[chrome #21]            at ManagedPromise.invokeCallback_ (/opt/perform/.nvm/versions/node/v8.0.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1376:14)
[chrome #21]            at TaskQueue.execute_ (/opt/perform/.nvm/versions/node/v8.0.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:3084:14)
[chrome #21]            at TaskQueue.executeNext_ (/opt/perform/.nvm/versions/node/v8.0.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:3067:27)
[chrome #21]            at asyncRun (/opt/perform/.nvm/versions/node/v8.0.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2927:27)
[chrome #21]            at /opt/perform/.nvm/versions/node/v8.0.0/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:668:7
[chrome #21]            at <anonymous>
[chrome #21]            at process._tickCallback (internal/process/next_tick.js:169:7)Error
[chrome #21]            at ElementArrayFinder.applyAction_ (/opt/perform/.nvm/versions/node/v8.0.0/lib/node_modules/protractor/built/element.js:459:27)
[chrome #21]            at ElementArrayFinder.(anonymous function).args [as getText] (/opt/perform/.nvm/versions/node/v8.0.0/lib/node_modules/protractor/built/element.js:91:29)
[chrome #21]            at ElementFinder.(anonymous function).args [as getText] (/opt/perform/.nvm/versions/node/v8.0.0/lib/node_modules/protractor/built/element.js:831:22)
[chrome #21]            at World.<anonymous> (/opt/perform/Desktop/AutomatedTests_/stepDefinitions/login2/feat1_stepUno.js:187:18)
[chrome #21]    - And I want to tsleep 4 seconds # ../stepDefinitions/login2/feat1_stepUno.js:198
[chrome #21]    - And I want to insert name # ../stepDefinitions/login2/feat1_stepUno.js:212
[chrome #21]    - And I want to tsleep 3 seconds # ../stepDefinitions/login2/feat1_stepUno.js:230
[chrome #21]    - And I want to select the desidere date # ../stepDefinitions/login2/feat1_stepUno.js:245
[chrome #21]    - And I want tosleep 3 seconds # ../stepDefinitions/login2/feat1_stepUno.js:290
[chrome #21]    - And I select the desidere date # ../stepDefinitions/login2/feat1_stepUno.js:275
[chrome #21]    - And I want tosleep 3 seconds # ../stepDefinitions/login2/feat1_stepUno.js:290

帮我谢谢!

0 个答案:

没有答案