How to long press on text in scrollview

try:

   // Java
    public boolean longTapElement_XCTest(MobileElement el) {
        try {
            JavascriptExecutor js = (JavascriptExecutor) driver;
            HashMap<String, String> tapObject = new HashMap<String, String>();
            tapObject.put("element", el.getId());
            js.executeScript("mobile:touchAndHold", tapObject);
            return true;
        } catch (Exception e) {
            return false;
        }
    }
1 Like