Getting Text from Modal : Protractor / Webdriver
-
20-12-2019 - |
Question
<input type="text" class="form-control input-lg" id="name" placeholder="Insert Your Name Here" ng-model="form.Name" required>
I have a model called as above. I'm trying to validate the text after it's inputted. I've seen other similar examples but nothing is working for me. I'm trying to test it with this setup. I end up getting
Expected null to equal 'Your Inputted Text'
In Page Object File.
this.formInput = element(by.model('form.Name'));
In Testing File.
setup.formInput.sendKeys('Jim');
setup.formName.click().then(function () {
expect(setup.formInput.getAttribute('form.Name')).toEqual('Jim');
});
How can I capture / confirm the text that was entered?
Solution
setup.formInput.getAttribute('value')
Not tested. But I am hoping that will return you the text you want
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow