我是一個新手,試圖不使用這麼多或所有使用ptor.sleep()
來電,特別是在點擊下面。下面的行永遠不會得到這個值(他們都返回Nan),除非我在下面的click()
之後包含ptor.sleep(1000);
調用。量角器單擊操作依賴於ptor.sleep()。我如何正確解析?
我已經做了各種嘗試,以使數組ELEM列表的點擊後的結果之前解決,包裹在功能等方面的點擊,但沒有我試過沒有睡眠通話作品。已閱讀量角器控制流程。
devCountString = parseInt(arr[i]);
感謝您的任何見解,或許真的很明顯我已經錯過了,這樣我可以刪除ptor.sleep()
電話。
我的規格:
describe('\n == patch List suite results == \n', function() {
// login already was done in config files, onPrepare function.
var ptor, noFilterCount;
// needed here if we turn ptor.ignoreSynchronization = false;
beforeEach(function() {
ptor = protractor.getInstance();
ptor.ignoreSynchronization = true;
browser.get('https://my.abc.com:3000/fixes');
ptor.sleep(1200);
}); //end beforeEach()
it('11 - verify filter fewer', function() {
var sevStringElm, sevString;
var applicableCount;
ptor.ignoreSynchronization = false;
ptor.sleep(500);
sevStringElm = element(by.css("input.form-control.bf-spinner"));
sevStringElm.clear();
ptor.sleep(500);
sevStringElm.sendKeys('8');
ptor.sleep(500);
// click on the "fewer" spinner, wrap the click to wrap the .
var fewerPromise = element(by.css("span.bf-spinner-toggle:nth-child(2)")).click();
ptor.sleep(1000);
// now get the list of clickable elements in each device card. by title
var applicableDevicesElm = element.all(by.css("[title$='Applicable\ Devices']"));
applicableDevicesElm.getText().then(function(arr) {
console.log("arr.length= "+arr.length);
for (var i = 0; i < arr.length; i++) {
devCountString = parseInt(arr[i]);
expect(devCountString).toBeLessThan(9);
};
});
});