/// <summary> /// Shortcut for <see cref="MoveAsync(decimal, decimal, MoveOptions)"/>, <see cref="DownAsync(ClickOptions)"/> and <see cref="UpAsync(ClickOptions)"/> /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="options"></param> /// <returns>Task</returns> public async Task ClickAsync(decimal x, decimal y, ClickOptions options = null) { options = options ?? new ClickOptions(); await MoveAsync(x, y).ConfigureAwait(false); await DownAsync(options).ConfigureAwait(false); if (options.Delay > 0) { await Task.Delay(options.Delay).ConfigureAwait(false); } await UpAsync(options).ConfigureAwait(false); }
/// <summary> /// Dispatches a `mouseup` event. /// </summary> /// <param name="options"></param> /// <returns>Task</returns> public async Task UpAsync(ClickOptions options = null) { options = options ?? new ClickOptions(); _button = MouseButton.None; await _client.SendAsync("Input.dispatchMouseEvent", new Dictionary <string, object>(){ { "type", "mouseReleased" }, { "button", options.Button }, { "x", _x }, { "y", _y }, { "modifiers", _keyboard.Modifiers }, { "clickCount", options.ClickCount } }); }
/// <summary> /// Dispatches a <c>mousedown</c> event. /// </summary> /// <param name="options"></param> /// <returns>Task</returns> public Task DownAsync(ClickOptions options = null) { options = options ?? new ClickOptions(); _button = options.Button; return(_client.SendAsync("Input.dispatchMouseEvent", new InputDispatchMouseEventRequest { Type = MouseEventType.MousePressed, Button = _button, X = _x, Y = _y, Modifiers = _keyboard.Modifiers, ClickCount = options.ClickCount })); }
/// <summary> /// Dispatches a <c>mousedown</c> event. /// </summary> /// <param name="options"></param> /// <returns>Task</returns> public Task DownAsync(ClickOptions options = null) { options = options ?? new ClickOptions(); _button = options.Button; return(_client.SendAsync("Input.dispatchMouseEvent", new Dictionary <string, object>() { { MessageKeys.Type, "mousePressed" }, { MessageKeys.Button, _button }, { MessageKeys.X, _x }, { MessageKeys.Y, _y }, { MessageKeys.Modifiers, _keyboard.Modifiers }, { MessageKeys.ClickCount, options.ClickCount } })); }
/// <summary> /// Dispatches a <c>mousedown</c> event. /// </summary> /// <param name="options"></param> /// <returns>Task</returns> public Task DownAsync(ClickOptions options = null) { options = options ?? new ClickOptions(); _button = options.Button; return(_client.SendAsync("Input.dispatchMouseEvent", new Dictionary <string, object>() { { "type", "mousePressed" }, { "button", _button }, { "x", _x }, { "y", _y }, { "modifiers", _keyboard.Modifiers }, { "clickCount", options.ClickCount } })); }