Double click/tap on an element?

Hey guys, finally decided to join the forum since I couldn’t figure this out by myself anymore.
I tried quite a few different ways and cannot find out how to double click on an element.
My framework is the following: Appium + Ruby + Cucumber.
I tried things like:
find_element(:xpath, xxxxx).double_click
find_element(:xpath, xxxxx).doubleClick
and all kinds of similar ones, but none of them seem to work.

Any ideas?

Thanks a bunch!

I didn’t find any implementation of double_click in the appium ruby_lib. Google turned up this solution – it’s implemented in Java, so you will have to translate:

https://groups.google.com/forum/#!topic/appium-discuss/4jhVN4ySSGI

working with android:

public boolean doubleTapElement(MobileElement element) {
        int x,y;
        try {
            x = element.getCenter().getX();
            y = element.getCenter().getY();
            ((AppiumDriver) driver).tap(1, x, y, 100);
            try{Thread.sleep(50);}catch (Exception e1) {}
            ((AppiumDriver) driver).tap(1, x, y, 100);
            try{Thread.sleep(100);}catch (Exception e1) {}
            return true;
        } catch (Exception e) {
            return false;
        }
    }
1 Like