-
Notifications
You must be signed in to change notification settings - Fork 2.3k
how to read text value of a element #140
Comments
I'm having the same issue. I just got protractor up and running but I can't seem to get data out of an input element. My test is: it('should allow text entry into the userName field', function(){
userNameInput = ptor.findElement(protractor.By.input('user.userName'));
userNameInput.sendKeys(testUserName);
expect(userNameInput.getText()).toEqual(testUserName);
}); but the test fails with: 1) Login Tests Sign In should allow text entry into the userName field As I watch the test (by slowing it down with Anyone have any ideas on what I'm doing wrong? |
@vishalshivnath Please check out the documentation for information on how webdriver and protractor work - protractor actions return promises, so you are probably a promise object. @tennisgent There's a weird webdriver quirk that getText() is always empty for |
is it ok to use $ instead of it('should return the same result as browser.findElement', function() {
browser.get('index.html');
// var e = element(by.id('new_todo'));
var e = $('#new-todo');
e.sendKeys("foo");
expect(e.getAttribute('value')).toEqual(
"foo")
}); |
I am trying to read the text value of binding element. I have used function getText() to read the text value of elements but its not working. Is there any other way to do so
ptor = protractor.getInstance();
ptor.get('http://www.angularjs.org');
var greeting = ptor.findElement(protractor.By.binding("{{yourName}}!"));
console.log(greeting.getText());
The text was updated successfully, but these errors were encountered: