Javascript WebDrivero Selenium将命令行参数从config.js文件传递到Chrome中
我需要chrome为我的UI测试运行禁用web安全标志。如何使用wdio.config文件()插入任何命令Javascript WebDrivero Selenium将命令行参数从config.js文件传递到Chrome中,javascript,google-chrome,selenium,webdriver-io,chrome-web-driver,Javascript,Google Chrome,Selenium,Webdriver Io,Chrome Web Driver,我需要chrome为我的UI测试运行禁用web安全标志。如何使用wdio.config文件()插入任何命令 您可以使用goog:chromeOptions capabilities: [{ browserName: 'chrome', 'goog:chromeOptions': { args: ['disable-web-security'] } }] 查看chromeOptions对象的更多信息。这是正确的语法,谢谢 capabilities: [
您可以使用
goog:chromeOptions
capabilities: [{
browserName: 'chrome',
'goog:chromeOptions': {
args: ['disable-web-security']
}
}]
查看chromeOptions对象的更多信息。这是正确的语法,谢谢
capabilities: [{
browserName: 'chrome',
'goog:chromeOptions': {
args: ['--disable-web-security']
}
}]
如果您想使用webdriverio在浏览器中禁用javascript,则需要在wdio.config中
capabilities: [{
browserName: 'chrome',
'goog:chromeOptions': {
"args" : ["start-fullscreen"],
"prefs" : {
'profile.managed_default_content_settings.javascript': 2
}
}
}]
某些内容已更改,因为在
@wdio/cli
版本5.11.13
和chromedriver
版本76.0.0
中,我无法传递参数chromeOptions
-结果:无效参数:无法识别的功能:chromeOptions
我做了一些研究并通过了goog:chromeOptions
works:
capabilities: [{
browserName: 'chrome',
'goog:chromeOptions': {
args: ['--disable-web-security'],
},
}]
capabilities: [{
browserName: 'chrome',
'goog:chromeOptions': {
args: ['--disable-web-security'],
},
}]