I have a canvas with unknown dimensions and position. I want to simulate clicking onto specific coordinates based on the dimensions and position of the canvas in protractor.
The following works, but is rather tedious:
var canvas = element(by.id("canvas"));
canvas.getCssValue("left").then(function (left) {
canvas.getCssValue("top").then(function (top) {
canvas.getCssValue("width").then(function(oldWidth) {
canvas.getCssValue("height").then(function (oldHeight) {
// some code that uses left, top, oldWidth and oldHeight together
})
})
})
}
)
})
})
Is there a more elegant way to use all these promises at once? I would really like to do something like the following:
var width = canvas.getCssValue("width");
var height = canvas.getCssValue("height");
var left = canvas.getCssValue("left");
var top = canvas.getCssValue("top");
//code that uses these variables.
But of course if defies the nature of promises. Thanks for your help.