New to Protractor and difficulty with collecting Select options

前端 未结 1 1253
故里飘歌
故里飘歌 2021-01-28 07:11

self teaching protractor and fighting issues of non angular web app and getting the list of all values out of a select control. here is the html but can\'t seem to validate the

相关标签:
1条回答
  • 2021-01-28 07:37

    First of all, use element notation - would at least look cleaner.

    If you want to see the option text or value on the console, you need to resolve promises:

    var weightUnitSelect = element(by.name("wu"));
    var options = weightUnitSelect.all(by.tagName("option"));
    
    options.first().getText().then(function (text) {
        console.log(text);
    });
    

    Also, I recommend to abstract select->option HTML constructions with the help of this answer:

    • Select -> option abstraction
    0 讨论(0)
提交回复
热议问题