【问题标题】:Modify flags while launching from chromedriver从 chromedriver 启动时修改标志
【发布时间】:2014-04-07 03:29:39
【问题描述】:

我正在使用 webdriver(http://webdriver.io/)、独立的 selenium、mocha 来编写我的测试用例。测试用例特定于 chrome,所以我使用的是 chromedriver。

在启动时,我希望禁用“touch-events”和“touch-optimized-ui”标志,否则我的测试用例将失败。

每次 chromedriver 启动浏览器时,它都会以默认选项启动。 有人可以为此提供解决方案吗?可以在下面的代码中添加什么来禁用这些标志?或者其他解决方案?

示例代码:

var webdriverjs = require('./webdriverjs/index'),
    assert      = require('assert');

describe('my webdriverjs tests', function(){

    this.timeout(99999999);
    var client = {};

    before(function(done){
            client = webdriverjs.remote({ desiredCapabilities: {browserName: 'chrome'} });
            client.init(done);
    });

    it('sample test',function(done) {
        client
            .url('http://localhost:3030/subset/index')
            .call(done)
    });

    after(function(done) {
        client.end(done);
    });
}); 

【问题讨论】:

    标签: javascript node.js selenium-webdriver selenium-chromedriver


    【解决方案1】:

    您可以在所需功能范围内传递任何 chrome 标志,如下所示:

    client = webdriverjs.remote({
        desiredCapabilities: {
            browserName: 'chrome',
            chromeOptions: {
                args: ['touch-events','touch-optimized-ui']
            }
        }
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-09-17
      • 2017-03-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-15
      • 1970-01-01
      • 1970-01-01
      • 2018-11-14
      相关资源
      最近更新 更多