gpt4 book ai didi

javascript - 从 chromedriver 启动时修改标志

转载 作者:行者123 更新时间:2023-11-29 22:02:45 25 4
gpt4 key购买 nike

我正在使用 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);
});
});

最佳答案

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

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

关于javascript - 从 chromedriver 启动时修改标志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22679123/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com