Jasmine 量角器ManagedPromise::2516{[[PromiseStatus]]:“待定”
我使用Jasmine的量角器,我使用页面对象模式。在我的一个页面对象中,我试图将鼠标悬停在饼图上。但是当我使用下面的方法时,它无法使用getDisHoverPoint()获得x坐标的值。当我为getDisHoverPoint()放置一个记录器时,它返回ManagedPromise::2516{[[PromiseStatus]]:“pending”}。请帮忙Jasmine 量角器ManagedPromise::2516{[[PromiseStatus]]:“待定”,jasmine,protractor,webdriverjs,Jasmine,Protractor,Webdriverjs,我使用Jasmine的量角器,我使用页面对象模式。在我的一个页面对象中,我试图将鼠标悬停在饼图上。但是当我使用下面的方法时,它无法使用getDisHoverPoint()获得x坐标的值。当我为getDisHoverPoint()放置一个记录器时,它返回ManagedPromise::2516{[[PromiseStatus]]:“pending”}。请帮忙 this.hoverMouse = function() { var dis = element(by .c
this.hoverMouse = function() {
var dis = element(by
.css('#piecontainer .highcharts-series>path[fill="#434348"]'));
function getDisHoverPoint() {
return dis.getSize().then(function(text) {
return (text['height'] / 2).toFixed(0);
});
}
browser.actions().mouseMove(dis, {
x : getDisHoverPoint(),
y : 0
}).perform();
}
您必须解析getDisHoverPoint()
才能获得x
的实际值:
this.hoverMouse = function() {
var dis = element(by
.css('#piecontainer .highcharts-series>path[fill="#434348"]'));
function getDisHoverPoint() {
return dis.getSize().then(function(text) {
return (text['height'] / 2).toFixed(0);
});
}
getDisHoverPoint().then(function (value) {
browser.actions().mouseMove(dis, {
x : value,
y : 0
}).perform();
});
}
事实上,我的原始代码确实有效。问题出在别处。谢谢你的帮助。