如何在ptor中使用全局变量?“窗口”前缀不起作用。
element(by.id("priceNet")).getText().then(function (getNet) {
net = getNet;
});
element(by.id("priceVat")).getText().then(function (getVat) {
vat = getVat;
});
console.log(vat + " " + net);
expect(element(by.id("priceTotal")).getText()).toContain(net + vat);
当我想使用window.net
ptor不知道时,window
我希望使用net和vat。
问题解决了。此解决方案有效。(ofc必须解析为Int或Float)
element(by.id("priceNet")).getText().then( function (getNet) {
element(by.id("priceVat")).getText().then( function (getVat) {
expect(element(by.id("priceTotal")).getText()).toContain(getNet + getVat);
})
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句