問題描述
我目前有量角器設置可以在我們的集成服務器上運行.在 protractor.conf.js 文件中,我有以下內容:
I currently have protractor setup to run on our integration server. Inside the protractor.conf.js file i have the following:
multiCapabilities: [{
'browserName': 'firefox',
'platform': 'MAC'
}, {
'browserName': 'chrome',
'platform': 'MAC'
}]
我想在從命令行本地運行時覆蓋它.我試過以下沒有成功
I would like to override this when running locally from the command line. I've tried the following with no success
protractor --verbose --browser=chrome
問題:從命令行本地運行時,如何切換到僅使用單個 chrome 實例?
Question: How do i switch to only using a single instance of chrome when running locally from the command line?
推薦答案
這是個問題.
根據源碼,瀏覽器
命令行參數是 capabilities.browserName
的別名.
According to the source code, browser
command line argument is an alias of capabilities.browserName
.
根據 referenceConf.js
文檔:
According to the referenceConf.js
documentation:
// If you would like to run more than one instance of WebDriver on the same
// tests, use multiCapabilities, which takes an array of capabilities.
// If this is specified, capabilities will be ignored.
multiCapabilities: [],
換句話說,由于指定了 multiCapabilities
,capabilities
將被忽略.
In other words, since multiCapabilities
are specified, capabilities
are ignored.
您可以嘗試從命令行重置 multiCapabilities
:
What you can try to do is to reset multiCapabilities
from command-line:
protractor --verbose --browser=chrome --multiCapabilities
作為另一種解決方法,使用單獨的配置文件來運行單個瀏覽器實例.
As an another workaround, have a separate config file for running a single browser instance.
另外,相關主題列表:
- 添加了對 multiCapabilities 對象和 splitTestsBetweenCapabilities 布爾值的支持
- Multicapabilities 規范忽略命令行上的 --specs 標志并繼續運行
這篇關于如何從命令行覆蓋 protractor.conf.js 值?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!