clj-commons / etaoin

Pure Clojure Webdriver protocol implementation
https://cljdoc.org/d/etaoin
Eclipse Public License 1.0
908 stars 95 forks source link

double-click does not work #367

Closed xlfe closed 2 years ago

xlfe commented 3 years ago

Hi - firstly thank you for this amazing test framework.

I'm trying to double click on an element connected to chromedriver.

For example:-

(api/double-click {:tag :span :aria-label "Double click me"})                                                                                                  

Which gives the following error :-

unknown command: session/3121b3b6cba39903f077b9ec25417d5a/element/0.7559889173480892-5/doubleclick

Having a look at what I think is relevant :-

https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessioniddoubleclick

It looks like it just double clicks the mouse based on a previous move-to command?

In contrast to the etaoin api which passes an element?

https://github.com/igrishaev/etaoin/blob/cc8ca480d5b0d0b49a28d1b6cbf40fd6bedf1ed6/src/etaoin/api.clj#L1023

I'm guessing the api needs to be updated so that it performs similarly to the other move-to / click calls?

Would you like me to put together a PR to address this?

igrishaev commented 3 years ago

@xlfe thank you for pointing this out. The thing is, the current implementation of double-click is based on JsonWire protocol. Since Chrome follows the official Webderiver W3C protocol, the method doesn't work anymore.

I think we can borrow the implementation from here:

https://github.com/webdriverio/webdriverio/blob/9d2220e89144b0ca69232737957ad5fc32ca1300/packages/webdriverio/src/commands/element/doubleClick.ts

igrishaev commented 3 years ago

Since Etaoin supports actions, we can easily implement this. We only need to validate all the existing drivers how do they behave.

lread commented 2 years ago

Ah... 💡 JWP=JsonWire Protocol, TIL.

Since there is a merge associated with this one, I'm going to assume it has been addressed? Feel free to re-open/reply if I have misunderstood.