gpt4 book ai didi

javascript - 期望(array_values).toBeGreaterThan(Some_Value)

转载 作者:行者123 更新时间:2023-11-30 14:52:10 25 4
gpt4 key购买 nike

我想比较数组值是否大于某个值。

我试过以下:

this.AllElements = element.all(by.css('[style="display: none"]'));
expect(this.AllElements.getText()).toBeGreaterThan(30);

我想验证 this.AllElements.getText() 返回的所有值都应该大于 30。

即使所有的值都大于 30,上面的 expect 语句也会失败。

最佳答案

一个直接的选择是使用 each()检查数组中的每个文本:

this.AllElements.each(function (elm) {
elm.getText().then(function (text) {
expect(parseInt(text)).toBeGreaterThan(30);
});
});

关于javascript - 期望(array_values).toBeGreaterThan(Some_Value),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47948357/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com