我无法在Selenium独立上编辑超时时间

Im not able to edit the timeout on Selenium Standalone

本文关键字:编辑 超时 时间 独立 Selenium      更新时间:2023-09-26

我正在尝试使用webdriverio, selenium standalone和Gulp创建一个测试自动化。Selenium在应用程序中运行,但我无法编辑Selenium超时默认值。页面加载得很好,但速度很慢,我得到了默认的10秒超时。如何编辑TimeOut?

下面是加载Selenium服务器的代码。 gulpfile。巴别塔
import gulp from 'gulp';
import selenium from 'selenium-standalone';
import webdriver from 'gulp-webdriver';
let seleniumServer;
gulp.task('selenium:start', (done) => {
    selenium.install({ logger: function(message) {} }, () => {
        selenium.start((err, child) => {
            if (err) { return done(err); }
            seleniumServer = child;
            done();
        });
    });
});
gulp.task('config:setup', ['selenium:start'], () => {
    return gulp.src('wdio.conf.js')
        .pipe(webdriver({
            waitforTimeout: 60000
        })).on('error', () => {
            seleniumServer.kill();
            process.exit(1);
        });
});
gulp.task('handler', ['config:setup'], () => {
    seleniumServer.kill();
});

我的测试用例

describe('Creating a new invitation request', function() {
    let _page, _container;
    before(() => {
        _page = new page.page();
        _container = new container.container();
    });
    it('request invitation', function() {
        _page.navigate(_container.urlBase);
        expect(_page.createNewRequest(_container.userToCreate));
    });
});

提前感谢。

编辑,添加wdio.conf.js

exports.config = {
    specs: [
        './testcases/*.js'
    ],
    exclude: [      
        './excluded/out/*.js'
    ],
    maxInstances: 1,
capabilities:
    capabilities: [{      
        maxInstances: 1,
        browserName: 'chrome'
    }],
    sync: true,
    logLevel: 'silent',
    coloredLogs: true,
    screenshotPath: './errorShots/',
    baseUrl: 'http://localhost',
    waitforTimeout: 90000,
    connectionRetryTimeout: 90000,
    connectionRetryCount: 3,
    framework: 'mocha',
    mochaOpts: {
        compilers: ['js:babel-core/register']
    }
}

wdio.conf.js文件上,在mochaOpts属性上添加timeout,并在compiler选项下添加所需的毫秒数。最后的配置是这样的:

  exports.config = {
    specs: [
        './testcases/*.js'
    ],
    exclude: [      
        './excluded/out/*.js'
    ],
    maxInstances: 1,
capabilities:
    capabilities: [{      
        maxInstances: 1,
        browserName: 'chrome'
    }],
    sync: true,
    logLevel: 'silent',
    coloredLogs: true,
    screenshotPath: './errorShots/',
    baseUrl: 'http://localhost',
    waitforTimeout: 90000,
    connectionRetryTimeout: 90000,
    connectionRetryCount: 3,
    framework: 'mocha',
    mochaOpts: {
        compilers: ['js:babel-core/register'],
        timeout: 90000
    }
}