更新时间:2023-02-22 11:15:42
在 referenceConf.js 这部分可能是有趣的:
In the referenceConf.js this section can be interesting:
// The params object will be passed directly to the protractor instance,
// and can be accessed from your test. It is an arbitrary object and can
// contain anything you may need in your test.
// This can be changed via the command line as:
// --params.login.user 'Joe'
params: {
login: {
user: 'Jane',
password: '1234'
}
},
和您可以访问params对象像这样在你的code: browser.params.login.user
And you can access the params object like this in your code: browser.params.login.user
所以你的情况,如果你调用量角器是这样的:
So in your case if you call protractor like this:
protractor ... --params.login.user=abc --params.login.password=123
您可以访问您code这些变量是这样的:
You can access these variables in your code like this:
browser.params.login.user
和 browser.params.login.password