/// <summary> /// Initializes a new instance of the <see cref="TouchActions"/> class. /// </summary> /// <param name="driver">The <see cref="IWebDriver"/> object on which the actions built will be performed.</param> public TouchActions(IWebDriver driver) : base(driver) { IHasTouchScreen touchScreenDriver = driver as IHasTouchScreen; if (touchScreenDriver == null) { IWrapsDriver wrapper = driver as IWrapsDriver; while (wrapper != null) { touchScreenDriver = wrapper.WrappedDriver as IHasTouchScreen; if (touchScreenDriver != null) { break; } wrapper = wrapper.WrappedDriver as IWrapsDriver; } } if (touchScreenDriver == null) { throw new ArgumentException("The IWebDriver object must implement or wrap a driver that implements IHasTouchScreen.", "driver"); } this.touchScreen = touchScreenDriver.TouchScreen; }
/// <summary> /// Initializes a new instance of the <see cref="SingleTapAction" /> class. /// </summary> /// <param name="touchScreen">The <see cref="ITouchScreen" /> with which the action will be performed.</param> /// <param name="actionTarget">An <see cref="ILocatable" /> describing an element at which to perform the action.</param> public SingleTapAction(ITouchScreen touchScreen, ILocatable actionTarget) : base(touchScreen, actionTarget) { if (actionTarget == null) { throw new ArgumentException("Must provide a location for a single tap action.", "actionTarget"); } }
/// <summary> /// Initializes a new instance of the <see cref="TouchActions"/> class. /// </summary> /// <param name="driver">The <see cref="IWebDriver"/> object on which the actions built will be performed.</param> public TouchActions(IWebDriver driver) : base(driver) { IHasTouchScreen touchScreenDriver = driver as IHasTouchScreen; if (touchScreenDriver == null) { IWrapsDriver wrapper = driver as IWrapsDriver; while (wrapper != null) { touchScreenDriver = wrapper.WrappedDriver as IHasTouchScreen; if (touchScreenDriver != null) { break; } wrapper = wrapper.WrappedDriver as IWrapsDriver; } } if (touchScreenDriver == null) { throw new ArgumentException("The IWebDriver object must implement or wrap a driver that implements IHasTouchScreen.", "driver"); } this.touchScreen = touchScreenDriver.TouchScreen; }
/// <summary> /// Initializes a new instance of the <see cref="LongPressAction"/> class. /// </summary> /// <param name="touchScreen">The <see cref="ITouchScreen"/> with which the action will be performed.</param> /// <param name="actionTarget">An <see cref="ILocatable"/> describing an element at which to perform the action.</param> public LongPressAction(ITouchScreen touchScreen, ILocatable actionTarget) : base(touchScreen, actionTarget) { if (actionTarget == null) { throw new ArgumentException("Must provide a location for a single tap action.", "actionTarget"); } }
/// <summary> /// Initializes a new instance of the <see cref = "ScrollAction"/> class for use with the specified element. /// </summary> /// <param name = "touchScreen">The <see cref = "ITouchScreen"/> with which the action will be performed.</param> /// <param name = "actionTarget">An <see cref = "ILocatable"/> describing an element at which to perform the action.</param> /// <param name = "offsetX">The x coordinate relative to the view port.</param> /// <param name = "offsetY">The y coordinate relative to the view port.</param> public ScrollAction(ITouchScreen touchScreen, ILocatable actionTarget, int offsetX, int offsetY) : base(touchScreen, actionTarget) { if (actionTarget == null) { throw new ArgumentException("Must provide a location for a single tap action.", "actionTarget"); } this.offsetX = offsetX; this.offsetY = offsetY; }
/// <summary> /// Initializes a new instance of the <see cref="ScrollAction"/> class for use with the specified element. /// </summary> /// <param name="touchScreen">The <see cref="ITouchScreen"/> with which the action will be performed.</param> /// <param name="actionTarget">An <see cref="ILocatable"/> describing an element at which to perform the action.</param> /// <param name="offsetX">The x coordinate relative to the view port.</param> /// <param name="offsetY">The y coordinate relative to the view port.</param> public ScrollAction(ITouchScreen touchScreen, ILocatable actionTarget, int offsetX, int offsetY) : base(touchScreen, actionTarget) { if (actionTarget == null) { throw new ArgumentException("Must provide a location for a single tap action.", "actionTarget"); } this.offsetX = offsetX; this.offsetY = offsetY; }
public TouchActions(IWebDriver driver) : base(driver) { IHasTouchScreen hasTouchScreen = driver as IHasTouchScreen; if (hasTouchScreen == null) { for (IWrapsDriver wrapsDriver = driver as IWrapsDriver; wrapsDriver != null; wrapsDriver = (wrapsDriver.WrappedDriver as IWrapsDriver)) { hasTouchScreen = (wrapsDriver.WrappedDriver as IHasTouchScreen); if (hasTouchScreen != null) { break; } } } if (hasTouchScreen == null) { throw new ArgumentException("The IWebDriver object must implement or wrap a driver that implements IHasTouchScreen.", "driver"); } this.touchScreen = hasTouchScreen.TouchScreen; }
public static ITouchScreen New(InputTypes inputType, IDisposableResource parent) { ITouchScreen api = null; #if iOS if (inputType == InputTypes.Cocoa) { TouchScreenAPI.Init(Reign.Input.Cocoa.TouchScreen.New); } #endif #if ANDROID if (inputType == InputTypes.Android) { TouchScreenAPI.Init(Reign.Input.Android.TouchScreen.New); } #endif if (api == null) { Debug.ThrowError("TouchScreenAPI", "Unsuported InputType: " + inputType); } return(api); }
/// <summary> /// Initializes a new instance of the <see cref="TouchAction"/> class. /// </summary> /// <param name="touchScreen">The <see cref="ITouchScreen"/> to use in performing the action.</param> /// <param name="actionTarget">An <see cref="ILocatable"/> object providing the element on which to perform the action.</param> protected TouchAction(ITouchScreen touchScreen, ILocatable actionTarget) : base(actionTarget) { this.touchScreen = touchScreen; }
/// <summary> /// Initializes a new instance of the <see cref="TouchAction"/> class. /// </summary> /// <param name="touchScreen">The <see cref="ITouchScreen"/> to use in performing the action.</param> /// <param name="actionTarget">An <see cref="ILocatable"/> object providing the element on which to perform the action.</param> protected TouchAction(ITouchScreen touchScreen, ILocatable actionTarget) : base(actionTarget) { this.touchScreen = touchScreen; }
/// <summary> /// Initializes a new instance of the <see cref="ScreenMoveAction"/> class. /// </summary> /// <param name="touchScreen">The <see cref="ITouchScreen"/> with which the action will be performed.</param> /// <param name="x">The x coordinate relative to the view port.</param> /// <param name="y">The y coordinate relative to the view port.</param> public ScreenMoveAction(ITouchScreen touchScreen, int x, int y) : base(touchScreen, null) { this.x = x; this.y = y; }
/// <summary> /// Initializes a new instance of the <see cref="ScrollAction"/> class. /// </summary> /// <param name="touchScreen">The <see cref="ITouchScreen"/> with which the action will be performed.</param> /// <param name="offsetX">The horizontal offset relative to the view port.</param> /// <param name="offsetY">The vertical offset relative to the view port.</param> public ScrollAction(ITouchScreen touchScreen, int offsetX, int offsetY) : this(touchScreen, null, offsetX, offsetY) { }
/// <summary> /// Initializes a new instance of the <see cref="FlickAction"/> class. /// </summary> /// <param name="touchScreen">The <see cref="ITouchScreen"/> with which the action will be performed.</param> /// <param name="speedX">The horizontal speed in pixels per second.</param> /// <param name="speedY">The vertical speed in pixels per second.</param> public FlickAction(ITouchScreen touchScreen, int speedX, int speedY) : base(touchScreen, null) { this.speedX = speedX; this.speedY = speedY; }
/// <summary> /// Initializes a new instance of the <see cref="AndroidDriver"/> class, /// communicating with the device at a specific URL. /// </summary> /// <param name="remoteAddress">The URL of the WebDriver application on the Android device.</param> public AndroidDriver(Uri remoteAddress) : base(remoteAddress, GetAndroidCapabilities()) { this.touchScreen = new RemoteTouchScreen(this); }
/// <summary> /// Initializes a new instance of the <see cref = "FlickAction"/> class. /// </summary> /// <param name = "touchScreen">The <see cref = "ITouchScreen"/> with which the action will be performed.</param> /// <param name = "speedX">The horizontal speed in pixels per second.</param> /// <param name = "speedY">The vertical speed in pixels per second.</param> public FlickAction(ITouchScreen touchScreen, int speedX, int speedY) : base(touchScreen, null) { this.speedX = speedX; this.speedY = speedY; }
/// <summary> /// Initializes a new instance of the <see cref="AndroidDriver"/> class, /// communicating with the device at a specific URL. /// </summary> /// <param name="remoteAddress">The URL of the WebDriver application on the Android device.</param> public AndroidDriver(Uri remoteAddress) : base(remoteAddress, GetAndroidCapabilities()) { this.touchScreen = new RemoteTouchScreen(this); }