Setting an Angular model using Protractor

后端 未结 2 1864
夕颜
夕颜 2021-01-06 10:44

I\'m trying to emulate a user story on my website with Protractor.

The user has to type in an input that uses auto-completion. In real life, the user has to type som

相关标签:
2条回答
  • 2021-01-06 11:21

    In this answer: How to select option in drop down protractorjs e2e tests

    They use this: .sendKeys(protractor.Key.ARROW_DOWN); for sending DOWN arrows.

    It worth a try.

    0 讨论(0)
  • 2021-01-06 11:26

    You can use .evaluate() to set your model value directly:

    var elm = element(by.model("obj.field"));
    elm.evaluate("obj.field = 'test';");
    

    To get the model value:

    elm.evaluate("obj.field").then(function (value) {
        console.log(value);
    });
    
    0 讨论(0)
提交回复
热议问题