selenium / standalone-chrome:2.53.1:使用此打开页面时为空白

时间:2016-12-12 13:05:09

标签: selenium selenium-webdriver nightwatch.js

我正在使用selenium / standalone-chrome-:2.53.1 docker image for nightwatch.conf.js来执行测试用例。

以下是nightwatch.conf.js的配置

'use strict';

const path = require('path');
const nightwatchCucumber = require('nightwatch-cucumber');
const cucumberConfig = {
    stepDefinitions: path.resolve(__dirname, 'features/step-definitions'),
};

module.exports = {
    src_folders: [nightwatchCucumber(cucumberConfig)],
    output_folder: 'reports',
    custom_commands_path: '',
    custom_assertions_path: '',
    globals_path: '',
    live_output: false,
    page_objects_path: path.resolve(__dirname, 'page-objects'),
    parallel_process_delay: 10,
    disable_colors: false,
    test_workers: false,

    test_settings: {
        default: {
            launch_url: 'any URL',
            selenium_host: 'localhost',
            selenium_port: 4444,
            silent: false,
            disable_colors: true,
            screenshots: {
                enabled: true,
                on_failure: true,
                path: path.resolve(__dirname, 'screenshots'),

            },
            desiredCapabilities: {
                browserName: 'chrome',
                chromeOptions: {
                    args: ['--no-sandbox']
                },
                //acceptSslCerts: true,
                //javascriptEnabled: true,
            },
            globals: {
                user: {
                    username: 'user1',
                    password: 'password1',
                },
                hrUser: {
                    username: 'user2',
                    password: 'password2',
                },
            }
        },

当我执行测试用例时,它们会失败。在控制台日志中:

Timed out while waiting for element <.AppLoginTest> to be present 
for 5000 milliseconds.  - expected "visible" but got: "not found"  
at Object.<anonymous> (/home/<user>/automation-tests/features/step-definitions/login.js:19:8) 
at next (native)

如果我使用普通铬执行上述测试用例,那么它会通过。 当我使用chrome无头浏览器运行测试用例时,问题才出现。 我不知道为什么这个错误会出现在无头浏览器中?我甚至使用了phantomJS并发现了同样的问题。     有人可以指出可能出现的问题吗?

0 个答案:

没有答案