How to click on Button until a dependent value reaches a certain value?

前端 未结 2 422
余生分开走
余生分开走 2021-01-24 14:20

With Protractor I\'m trying to automate a part of a UI, in which with plus-minus buttons a min-max-range (i.e. 100\'000-200\'000) is selected.

There is an inputAmo

2条回答
  •  时光说笑
    2021-01-24 15:00

    I don't have the right to comment so I put it as an answer, did you put all your code inside then() - after the promise returns the value ?

    The currentMax is a variable initialized once, does the loop ends once it enters it !?

    You mentioned currentMax and in code there is max are they the same ? what does the btnPlus click increments, the max ?

    Finally I would suggest something similar to:

    $('.max').getText().then(function(value){
        var currentMax = parseInt(value.replace(/\'/,''));
        var btnPlus = $('.slider-buttons .slider-button-plus');
        for (i = currentMax; i <= inputAmount; i++) {
            btnPlus.click();
            browser.wait(300);
        };
    });
    

提交回复
热议问题