量角器中的动态变量

饼干

如何在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.netptor不知道时,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] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章