In a particular scenario I have to get full control of my mouse and with the actions()
class I'm not able to do it.
In my application there is a map and there is a functionality, which uses lasso to select certain portion of the map (say we draw a circle with lasso and selection is represented by a red circle), then only a pop up comes for further navigation, but when I use actions class like below
var loc = element(by.xpath("//span[@id='imgLasso']"));
browser.actions()
.mouseMove(loc, {x: 550, y: 436})
.mouseDown()
.mouseMove({x: 700, y: 236})
.perform();
actual mouse movement doesn't occur and I found no solution, except using Java robot class, hence I want to create a batch file, which calls a Java class with robot methods in it, but I'm not sure how to do it.
UPDATE
it("working with lasso",function() {
browser.sleep(5000);
element(by.xpath("//span[@id='imgLasso']")).click();
var plot0 = element(by.xpath("//span[@id='imgLasso']"));
browser.sleep(2000); // intentional wait
browser.actions()
.mouseMove({x: 100, y: 100})
.mouseDown()
.mouseMove({x: 400, y: 0})
.perform();
browser.sleep(8000);
element(by.xpath("//*[@id='imputTerritory']")).sendKeys("NewTeritory");
});
on execution of the code above, here are my observations:
- Till
var plot0
line, code is executed normally. - After that
browser.action()...
get executed only just before Chrome is closed by protractor. Don't know why. (also I have included sleep to verify that) - Also just before Chrome is closed I can see a straight red line on the map, but not followed by any pop up (it's possible the mouse is not released by actions class)
Just to add this time I'm not passing any plot0
element in the code, I'm just keeping my mouse pointer on the map manually, just before above spec is executed.