Setting an Angular model using Protractor

后端 未结 2 1885
夕颜
夕颜 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: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);
    });
    

提交回复
热议问题