从量角器(硒)激活时激活 chrome 语言标志 [英] Activating chrome language flags when activating from protractor (selenium)
问题描述
我正在使用 Protractor 为 Angular 网站编写端到端测试.
I'm writing end to end tests with Protractor for an angular website.
我们必须支持某些语言,所以我想使用 --lang
标志初始化 chrome 并使用其他语言启动它.我在网上搜索,找不到任何关于如何做到这一点的例子.
We have to support certain languages so I would like to init chrome using the --lang
flag and start it with some other language. I searched the web and couldn't find any example to how it can be done.
我唯一的线索是我看到并理解我需要将功能"部分添加到量角器配置文件中的一些文章,我可以在那里定义args"属性.
My only lead was some article I saw and understood that I need to add to Protractor config file the "capabilities" section and there I can define the "args" property.
然后尝试修补它,但没有运气.
Then tried to tinker with it but no luck.
欢迎任何帮助.
谢谢,
阿隆
推荐答案
事实证明 - 答案一直在文档中.这就是你为 chrome 做的事情,我猜它对其他浏览器类似:protractor.conf.js 里面(西班牙语):
As it turns out - the answer was in the docs all along. This is how you do it for chrome and i guess it similar for other browsers: inside the protractor.conf.js (for Spanish):
capabilities: {
browserName: 'chrome',
version: '',
platform: 'ANY',
'chromeOptions': {
'args': ['lang=es-ES']}
}
这篇关于从量角器(硒)激活时激活 chrome 语言标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!