Example usage for org.openqa.selenium.remote InterfaceImplementation InterfaceImplementation

List of usage examples for org.openqa.selenium.remote InterfaceImplementation InterfaceImplementation

Introduction

In this page you can find the example usage for org.openqa.selenium.remote InterfaceImplementation InterfaceImplementation.

Prototype

InterfaceImplementation

Source Link

Usage

From source file:org.uiautomation.ios.client.uiamodels.impl.augmenter.AddIOSTouchScreen.java

License:Apache License

@Override
public InterfaceImplementation getImplementation(Object value) {
    return new InterfaceImplementation() {

        public Object invoke(ExecuteMethod exec, Object self, Method method, Object... args) {
            RemoteWebDriver driver = (RemoteWebDriver) self;
            WebDriverLikeCommandExecutor executor = new WebDriverLikeCommandExecutor(driver);

            if ("dragFromToForDuration".equals(method.getName())) {
                Point from = (Point) args[0];
                Point to = (Point) args[1];
                int duration = (Integer) args[2];
                RemoteIOSDriver.dragFromToForDuration(executor, from, to, duration);
                return null;
            } else if ("pinchCloseFromToForDuration".equals(method.getName())) {
                Point from = (Point) args[0];
                Point to = (Point) args[1];
                int duration = (Integer) args[2];
                RemoteIOSDriver.pinchCloseFromToForDuration(executor, from, to, duration);
                return null;
            } else if ("pinchOpenFromToForDuration".equals(method.getName())) {
                Point from = (Point) args[0];
                Point to = (Point) args[1];
                int duration = (Integer) args[2];
                RemoteIOSDriver.pinchOpenFromToForDuration(executor, from, to, duration);
                return null;
            } else {
                throw new WebDriverException(method.getName() + " isn't recognized for IOSTouchScreen");
            }/* w ww  . j a v a2  s .  c o m*/
        }
    };
}