protractor double click in a specific location
Asked Answered
M

3

6

I'm developing a system (with AngularJS) that has a feature that is invoked by double clicking in a place on a web page and then I get the coordinates of the mouse and do what I want.

I'm trying to do e2e testing using protractor and I can't find any information on how to simulate the double click and get the location back.

Does anyone have an idea about this?

Thanks!

Mccallion answered 28/10, 2013 at 9:26 Comment(0)
B
10
browser.actions().doubleClick(myElement).perform()
Babel answered 21/1, 2014 at 11:5 Comment(0)
M
16

You can do this with a WebDriver ActionSequence, but you have to tell it where to click instead of getting the location back:

browser.actions().mouseMove({x: 50, y: 50}).doubleClick().perform()

Messeigneurs answered 31/10, 2013 at 19:56 Comment(0)
B
10
browser.actions().doubleClick(myElement).perform()
Babel answered 21/1, 2014 at 11:5 Comment(0)
H
0

You should be able to do a test the same way you would test ng-click, just twice

it('should check ng-click', function() {
   expect(binding('count')).toBe('0');
   element('.doc-example-live :button').click();
   element('.doc-example-live :button').click();
   expect(binding('count')).toBe('1');
 });
Hydroxyl answered 28/10, 2013 at 10:10 Comment(3)
I need to get the location of the clicks and not the element that was clicked.Mccallion
Wouldn't the verification be simply getting the coordinates of the elements and comparing it against the results that you've gotten?Hydroxyl
Remember element.click returns a Promise.Epitomize

© 2022 - 2024 — McMap. All rights reserved.