从量角器(硒)激活时激活chrome语言标志 [英] Activating chrome language flags when activating from protractor (selenium)
问题描述
我正在用Protractor为一个有角度的网站编写端到端测试.
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.
我唯一的线索是我看到并理解的一些文章,我需要在Protractor配置文件中添加功能"部分,然后在其中定义"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.
任何帮助都将受到欢迎.
Any help will be most welcome.
谢谢
阿隆
推荐答案
事实证明-答案一直都存在于文档中. 这是您针对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屋!