Protractor: element.getText() returns an object bu

2019-09-03 13:37发布

This question already has an answer here:

I have also checked link: Protractor: element.getText() returns an object and not String but i found no answer for that on above link and i want string in return??

1条回答
【Aperson】
2楼-- · 2019-09-03 14:24

All the protractor's methods return promises, to resolve that promise you need to send something like this:

element.getText().then(function(text) {
console.log(text);
});
or use "expect"-->jasmine's assertion
expect(element.getText()).toEqual("Your Text");

for detailed idea on promises i suggest please go through this link : http://www.html5rocks.com/en/tutorials/es6/promises/

查看更多
登录 后发表回答