Skip to content Skip to sidebar Skip to footer

Setting An Angular Model Using Protractor

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 some text in the in

Solution 1:

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);
});

Solution 2:

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.

Post a Comment for "Setting An Angular Model Using Protractor"