Is it possible to move the mouse to arbitrary coordinates on the screen/relative to an element in Protractor tests? I see people recommend using Robot for Java users, but of course I can't use that in JavaScript.
Drag and Drop Mouse Actions In Selenium Protractor The dragAndDrop() action of the mouse event drags the source element to the target element via mouse actions in Selenium Protractor. After this, you can perform any other operation, as per your requirement.
How do you do a hover action on a protractor? mouseMove / hover in protractor With the object of the action, you should first move to the menu element, and then move to the submenu item and click it or perform whatever action you wish.
I figured it out for myself...just took some deep digging through Protractor and Selenium documentation. Here is some example code:
it('should pan plots when you click and drag', function() { var plot0 = element(by.css('.plot > canvas')); browser.actions() .mouseMove(plot0, {x: 100, y: 100}) // 100px from left, 100 px from top of plot0 .mouseDown() .mouseMove({x: 400, y: 0}) // 400px to the right of current location .perform(); });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With