量角器:element.getText()返回一个对象,但不返回String [英] Protractor: element.getText() returns an object but not String
本文介绍了量角器:element.getText()返回一个对象,但不返回String的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我还检查了链接:量角器:element.getText ()返回一个对象而不是String 但是我在上面的链接上没有找到答案,我想返回字符串?
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??
推荐答案
所有量角器的方法都返回promise,以解决该promise,您需要发送以下内容:
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");
有关承诺的详细想法,我建议您通过以下链接进行: http://www.html5rocks.com/zh-CN/tutorials/es6/promises/
for detailed idea on promises i suggest please go through this link : http://www.html5rocks.com/en/tutorials/es6/promises/
这篇关于量角器:element.getText()返回一个对象,但不返回String的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文