1

I m trying to check a if condition and do a click if its true, but it returns me a error 'eachOperator.toEqual is not a function'

var selectDropdownbyNum = function (element, optionNum) {  
    var opt = element.all(by.tagName('option'));
    opt.each(function (eachOperator) {
        eachOperator.toEqual('-').then(function (subtract) {
            if (subtract) {
                eachOperator.click();
            }
        });
    });
};
Mano Kugan
  • 207
  • 6
  • 23

1 Answers1

1

Do you try it or?

var selectDropdownbyNum = function (element, optionNum) {  
    var opt = element.all(by.tagName('option'));
    opt.each(function (eachOperator) {
        eachOperator.getAttribute('value').then(function (value) {
            if (value === '-') {
                eachOperator.click();
            }
        });
    });
};
Tan Duong
  • 2,124
  • 1
  • 11
  • 17