How to use Mouse class of PuppeteerSharp.Input package

Best Puppeteer-sharp code snippet using PuppeteerSharp.Input.Mouse

PageServer.cs

Source:PageServer.cs Github

copy

Full Screen

...453 smallmap.Dispose();454 var list = cv.GetPoints2(Rsct);455 var slider = await page.WaitForXPathAsync("//div[@class='sp_msg']/img");456 var box = await slider.BoundingBoxAsync();457 await page.Mouse.MoveAsync(box.X, box.Y);458 await page.Mouse.DownAsync();459 Random r = new Random(Guid.NewGuid().GetHashCode());460 var Steps = r.Next(5, 15);461 foreach (var item in list)462 {463 await page.Mouse.MoveAsync(item.X, box.Y, new PuppeteerSharp.Input.MoveOptions { Steps = Steps });464 }465 await page.Mouse.UpAsync();466 await page.WaitForTimeoutAsync(1000);467 var html = await page.GetContentAsync();468 469 ResultModel<object> result = ResultModel<object>.Create(false, "");470 if (html.Contains("重新获取"))471 {472 Console.WriteLine("验证成功");473 result.success = true;474 }475 else476 {477 if (html.Contains("短信验证码发送次数已达上限"))478 {479 await PageClose(Phone);...

Full Screen

Full Screen

Methods.cs

Source:Methods.cs Github

copy

Full Screen

...49 data.Logger.Log($"Typed {text}", LogColors.DarkSalmon);50 }51 [Block("Clicks an element", name = "Click")]52 public static async Task PuppeteerClick(BotData data, FindElementBy findBy, string identifier, int index,53 PuppeteerSharp.Input.MouseButton mouseButton = PuppeteerSharp.Input.MouseButton.Left, int clickCount = 1,54 int timeBetweenClicks = 0)55 {56 data.Logger.LogHeader();57 var frame = GetFrame(data);58 var elem = (await frame.QuerySelectorAllAsync(BuildSelector(findBy, identifier)))[index];59 await elem.ClickAsync(new PuppeteerSharp.Input.ClickOptions { Button = mouseButton, ClickCount = clickCount, Delay = timeBetweenClicks });60 data.Logger.Log($"Clicked {clickCount} time(s) with {mouseButton} button", LogColors.DarkSalmon);61 }62 [Block("Submits a form", name = "Submit")]63 public static async Task PuppeteerSubmit(BotData data, FindElementBy findBy, string identifier, int index)64 {65 data.Logger.LogHeader();66 var elemScript = GetElementScript(findBy, identifier, index);67 var frame = GetFrame(data);...

Full Screen

Full Screen

Index.cshtml.cs

Source:Index.cshtml.cs Github

copy

Full Screen

...75 var slideBtn = await page.WaitForSelectorAsync("#nc_1_n1t", new WaitForSelectorOptions { Timeout = 3 * 1000 });76 var rect = await slideBtn.BoundingBoxAsync();77 var left = rect.X + 10;78 var top = rect.Y + 10;79 var mouse = page.Mouse;80 await mouse.MoveAsync(left, top);81 await page.Touchscreen.TapAsync(left, top);82 await mouse.DownAsync();83 var startTime = DateTime.Now;84 await mouse.MoveAsync(left + 800, top, new PuppeteerSharp.Input.MoveOptions { Steps = 30 });85 await page.Touchscreen.TapAsync(left + 800, top);86 Console.WriteLine(DateTime.Now - startTime);87 await mouse.UpAsync();88 var success = await page.WaitForSelectorAsync(".yes", new WaitForSelectorOptions { Timeout = 3000 });89 string content = await page.GetContentAsync();90 91 var parser = new HtmlParser();92 var document = await parser.ParseDocumentAsync(content);93 aliToken = (document.GetElementById("aliToken") as IHtmlInputElement).GetAttribute("sms");...

Full Screen

Full Screen

WebScraper.cs

Source:WebScraper.cs Github

copy

Full Screen

...13 public class WebScraper : IDisposable14 {15 private readonly Browser m_browser;16 private readonly Page m_page;17 private decimal m_MouseX = 0;18 private decimal m_MouseY = 0;19 /// <summary>20 /// Defualt agent string this library uses. Simulates Chrome installed on windows 10.21 /// </summary>22 public static readonly string DefaultAgent =23 "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36";24 /// <summary>25 /// Constructor.26 /// </summary>27 /// <param name="headless">Set to false to show chromium window.</param>28 /// <param name="agent">Agent to use when accessing pages. Uses DefaultAgent if non is set.</param>29 public WebScraper(bool headless = true, string agent = "")30 {31 if (agent == "")32 agent = DefaultAgent;33 var ops = new BrowserFetcherOptions34 {35 Path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\scraperion\\browser"36 };37 (new BrowserFetcher(ops).DownloadAsync(BrowserFetcher.DefaultRevision)).Wait();38 var browser = Puppeteer.LaunchAsync(new LaunchOptions39 {40 Headless = headless,41 IgnoreHTTPSErrors = true,42 });43 browser.Wait();44 m_browser = browser.Result;45 var page = m_browser.NewPageAsync();46 page.Wait();47 m_page = page.Result;48 m_page.Error += (s, e) => {49 Console.WriteLine("Error:" + e.ToString());50 };51 m_page.PageError += (s, e) =>52 {53 Console.WriteLine("Error:" + e.ToString());54 };55 m_page.Console += (s, e) => { Console.WriteLine(e.Message.Text); };56 m_page.SetUserAgentAsync(agent).Wait();57 }58 /// <summary>59 /// Set username and password to authenticate against web pages with.60 /// </summary>61 /// <param name="username">Username to authenticate with</param>62 /// <param name="password">Password to autrhenticate with.</param>63 public void SetAuth(string username, string password)64 {65 SetAuthAsync(username, password).Wait();66 }67 private async Task SetAuthAsync(string username, string password)68 {69 await m_page.AuthenticateAsync(new Credentials {Username = username, Password = password});70 }71 /// <summary>72 /// Sets the view port size of the page.73 /// </summary>74 /// <param name="width">Width of the page in pixels.</param>75 /// <param name="height">Height of page in pixels.</param>76 public void SetViewPort(int width, int height)77 {78 SetViewPortAsync(width, height).Wait();79 }80 private async Task SetViewPortAsync(int width, int height)81 {82 await m_page.SetViewportAsync(new ViewPortOptions83 {84 Width = width,85 Height = height86 });87 }88 /// <summary>89 /// Gets or sets the url the page is currently at.90 /// </summary>91 public string Url92 {93 get => m_page.Url;94 set95 {96 try97 {98 m_page.GoToAsync(value).Wait();99 }100 catch (Exception e)101 {102 Console.WriteLine(e);103 }104 }105 }106 /// <summary>107 /// Executes a javascript expression on page.108 /// This is simuilar to typing a command in the java console.109 /// </summary>110 /// <param name="script">Expression to run.</param>111 /// <returns>Json of executed result.</returns>112 public string Exec(string script)113 {114 var result = ExecAsync(script);115 result.Wait();116 return result.Result;117 }118 private async Task<string> ExecAsync(string script)119 {120 var data = await m_page.EvaluateExpressionAsync(script);121 return (string)data.ToString();122 }123 /// <summary>124 /// Takes a screenshot of the target page.125 /// </summary>126 /// <returns>Bitmap image containing screenshot.</returns>127 public Bitmap SnapshotBitmap()128 {129 var result = SnapshotBitmapAsync();130 result.Wait();131 return result.Result;132 }133 private async Task<Bitmap> SnapshotBitmapAsync()134 {135 var data = await m_page.ScreenshotStreamAsync();136 var image = new Bitmap(data);137 data.Dispose();138 return image;139 }140 /// <summary>141 /// Simulates key presses on page.142 /// </summary>143 /// <param name="text">Text to send to page.</param>144 public void SendKeys(string text)145 {146 SendKeysAsync(text).Wait();147 }148 private async Task SendKeysAsync(string text)149 {150 await m_page.Keyboard.TypeAsync(text);151 }152 /// <summary>153 /// Simulates moving the mouse on the page.154 ///155 /// Note: this does not move the system mouse.156 /// </summary>157 /// <param name="x">X coordinates to move mouse to.</param>158 /// <param name="y">Y coordinates to move mouse to.</param>159 public void MoveMouse(decimal x, decimal y)160 {161 MoveMouseAsync(x, y).Wait();162 }163 private async Task MoveMouseAsync(decimal x, decimal y)164 {165 await m_page.Mouse.MoveAsync(x, y);166 m_MouseX = x;167 m_MouseY = y;168 }169 /// <summary>170 /// Simulates a mouse click on page.171 /// </summary>172 /// <param name="button">Mouse button to simulate.</param>173 public void MouseClick(MouseButton button)174 {175 MouseClickAsync(button).Wait();176 }177 private async Task MouseClickAsync(MouseButton button)178 {179 await m_page.Mouse.ClickAsync(m_MouseX, m_MouseY, new ClickOptions{ Button = button == MouseButton.Left ? PuppeteerSharp.Input.MouseButton.Left : PuppeteerSharp.Input.MouseButton.Right });180 }181 /// <summary>182 /// Simulates a mouse up event on page.183 /// </summary>184 /// <param name="button">Mouse button to simulate.</param>185 public void MouseUp(MouseButton button)186 {187 MouseUpAsync(button).Wait();188 189 }190 private async Task MouseUpAsync(MouseButton button)191 {192 await m_page.Mouse.UpAsync(new ClickOptions { Button = button == MouseButton.Left ? PuppeteerSharp.Input.MouseButton.Left : PuppeteerSharp.Input.MouseButton.Right });193 }194 /// <summary>195 /// Simulates a mouse down event on page.196 /// </summary>197 /// <param name="button">Mouse button to simulate.</param>198 public void MouseDown(MouseButton button)199 {200 MouseDownAsync(button).Wait();201 }202 private async Task MouseDownAsync(MouseButton button)203 {204 await m_page.Mouse.DownAsync(new ClickOptions { Button = button == MouseButton.Left ? PuppeteerSharp.Input.MouseButton.Left : PuppeteerSharp.Input.MouseButton.Right });205 }206 /// <summary>207 /// Simulates a touch tap on a page.208 /// </summary>209 /// <param name="target">Javascript selector for element to tap on.</param>210 public void TapScreen(string target)211 {212 TapScreenAsync(target).Wait();213 }214 private async Task TapScreenAsync(string target)215 {216 await m_page.TapAsync(target);217 }218 /// <summary>...

Full Screen

Full Screen

Mouse.cs

Source:Mouse.cs Github

copy

Full Screen

...5{6 /// <summary>7 /// Provides methods to interact with the mouse8 /// </summary>9 public class Mouse10 {11 private readonly CDPSession _client;12 private readonly Keyboard _keyboard;13 private decimal _x = 0;14 private decimal _y = 0;15 private MouseButton _button = MouseButton.None;16 /// <summary>17 /// Initializes a new instance of the <see cref="Mouse"/> class.18 /// </summary>19 /// <param name="client">The client</param>20 /// <param name="keyboard">The keyboard</param>21 public Mouse(CDPSession client, Keyboard keyboard)22 {23 _client = client;24 _keyboard = keyboard;25 }26 /// <summary>27 /// Dispatches a <c>mousemove</c> event.28 /// </summary>29 /// <param name="x"></param>30 /// <param name="y"></param>31 /// <param name="options"></param>32 /// <returns>Task</returns>33 public async Task MoveAsync(decimal x, decimal y, MoveOptions options = null)34 {35 options = options ?? new MoveOptions();36 decimal fromX = _x;37 decimal fromY = _y;38 _x = x;39 _y = y;40 int steps = options.Steps;41 for (var i = 1; i <= steps; i++)42 {43 await _client.SendAsync("Input.dispatchMouseEvent", new Dictionary<string, object>44 {45 { MessageKeys.Type, "mouseMoved" },46 { MessageKeys.Button, _button },47 { MessageKeys.X, fromX + ((_x - fromX) * ((decimal)i / steps)) },48 { MessageKeys.Y, fromY + ((_y - fromY) * ((decimal)i / steps)) },49 { MessageKeys.Modifiers, _keyboard.Modifiers}50 }).ConfigureAwait(false);51 }52 }53 /// <summary>54 /// Shortcut for <see cref="MoveAsync(decimal, decimal, MoveOptions)"/>, <see cref="DownAsync(ClickOptions)"/> and <see cref="UpAsync(ClickOptions)"/>55 /// </summary>56 /// <param name="x"></param>57 /// <param name="y"></param>58 /// <param name="options"></param>59 /// <returns>Task</returns>60 public async Task ClickAsync(decimal x, decimal y, ClickOptions options = null)61 {62 options = options ?? new ClickOptions();63 await MoveAsync(x, y).ConfigureAwait(false);64 await DownAsync(options).ConfigureAwait(false);65 if (options.Delay > 0)66 {67 await Task.Delay(options.Delay).ConfigureAwait(false);68 }69 await UpAsync(options).ConfigureAwait(false);70 }71 /// <summary>72 /// Dispatches a <c>mousedown</c> event.73 /// </summary>74 /// <param name="options"></param>75 /// <returns>Task</returns>76 public Task DownAsync(ClickOptions options = null)77 {78 options = options ?? new ClickOptions();79 _button = options.Button;80 return _client.SendAsync("Input.dispatchMouseEvent", new Dictionary<string, object>()81 {82 { MessageKeys.Type, "mousePressed" },83 { MessageKeys.Button, _button },84 { MessageKeys.X, _x },85 { MessageKeys.Y, _y },86 { MessageKeys.Modifiers, _keyboard.Modifiers },87 { MessageKeys.ClickCount, options.ClickCount }88 });89 }90 /// <summary>91 /// Dispatches a <c>mouseup</c> event.92 /// </summary>93 /// <param name="options"></param>94 /// <returns>Task</returns>95 public Task UpAsync(ClickOptions options = null)96 {97 options = options ?? new ClickOptions();98 _button = MouseButton.None;99 return _client.SendAsync("Input.dispatchMouseEvent", new Dictionary<string, object>()100 {101 { MessageKeys.Type, "mouseReleased" },102 { MessageKeys.Button, options.Button },103 { MessageKeys.X, _x },104 { MessageKeys.Y, _y },105 { MessageKeys.Modifiers, _keyboard.Modifiers },106 { MessageKeys.ClickCount, options.ClickCount }107 });108 }109 }110}...

Full Screen

Full Screen

pay.cshtml.cs

Source:pay.cshtml.cs Github

copy

Full Screen

...51 {52 var rect = await slideBtn.BoundingBoxAsync();53 var left = rect.X + 10;54 var top = rect.Y + 10;55 var mouse = page.Mouse;56 await mouse.MoveAsync(left, top);57 await page.Touchscreen.TapAsync(left, top);58 await mouse.DownAsync();59 var startTime = DateTime.Now;60 await mouse.MoveAsync(left + 800, top, new PuppeteerSharp.Input.MoveOptions { Steps = 30 });61 await page.Touchscreen.TapAsync(left + 800, top);62 Console.WriteLine(DateTime.Now - startTime);63 await mouse.UpAsync();64 }65 var channel = await page.WaitForSelectorAsync("[channelcode='alipaywap']");66 await channel.ClickAsync();67 var submit = await page.WaitForSelectorAsync("body > div.mask.confirmPay > section > div.btnPd > button");68 await submit.ClickAsync();69 }...

Full Screen

Full Screen

IPuppeteerBrowser.cs

Source:IPuppeteerBrowser.cs Github

copy

Full Screen

...38 /// <param name="defaultCountryCode">The country code tu return default details.</param>39 /// <returns>The instance of <see cref="IpDetails"></see></returns>40 Task<IpDetails> GetIpDetails(string ipFetcherUrl, string defaultCountryCode);41 Task CloseAsync();42 Task<Page> MouseClickAndGetPage(BoundingBox box, Page page);43 }44}...

Full Screen

Full Screen

InputDispatchMouseEventRequest.cs

Source:InputDispatchMouseEventRequest.cs Github

copy

Full Screen

1using PuppeteerSharp.Input;2namespace PuppeteerSharp.Messaging3{4 internal class InputDispatchMouseEventRequest5 {6 public MouseEventType Type { get; set; }7 public MouseButton Button { get; set; }8 public decimal X { get; set; }9 public decimal Y { get; set; }10 public int Modifiers { get; set; }11 public int ClickCount { get; set; }12 public decimal DeltaX { get; set; }13 public decimal DeltaY { get; set; }14 }15}...

Full Screen

Full Screen

Mouse

Using AI Code Generation

copy

Full Screen

1var mouse = page.Mouse;2await mouse.MoveAsync(100, 100);3await mouse.ClickAsync();4var mouse = page.Mouse;5await mouse.MoveAsync(100, 100);6await mouse.ClickAsync();7var mouse = page.Mouse;8await mouse.MoveAsync(100, 100);9await mouse.ClickAsync();10var mouse = page.Mouse;11await mouse.MoveAsync(100, 100);12await mouse.ClickAsync();13var mouse = page.Mouse;14await mouse.MoveAsync(100, 100);15await mouse.ClickAsync();16var mouse = page.Mouse;17await mouse.MoveAsync(100, 100);18await mouse.ClickAsync();19var mouse = page.Mouse;20await mouse.MoveAsync(100, 100);21await mouse.ClickAsync();22var mouse = page.Mouse;23await mouse.MoveAsync(100, 100);24await mouse.ClickAsync();25var mouse = page.Mouse;26await mouse.MoveAsync(100, 100);27await mouse.ClickAsync();28var mouse = page.Mouse;29await mouse.MoveAsync(100, 100);30await mouse.ClickAsync();31var mouse = page.Mouse;32await mouse.MoveAsync(100, 100);33await mouse.ClickAsync();34var mouse = page.Mouse;35await mouse.MoveAsync(100, 100);36await mouse.ClickAsync();37var mouse = page.Mouse;

Full Screen

Full Screen

Mouse

Using AI Code Generation

copy

Full Screen

1using PuppeteerSharp.Input;2using PuppeteerSharp;3using System.Threading.Tasks;4using System;5using System.IO;6using System.Diagnostics;7using System.Net.Http;8using System.Collections.Generic;9using PuppeteerSharp.Input;10using PuppeteerSharp;11using System.Threading.Tasks;12using System;13using System.IO;14using System.Diagnostics;15using System.Net.Http;16using System.Collections.Generic;17using PuppeteerSharp.Input;18using PuppeteerSharp;19using System.Threading.Tasks;20using System;21using System.IO;22using System.Diagnostics;23using System.Net.Http;24using System.Collections.Generic;25using PuppeteerSharp.Input;26using PuppeteerSharp;27using System.Threading.Tasks;28using System;29using System.IO;30using System.Diagnostics;31using System.Net.Http;

Full Screen

Full Screen

Mouse

Using AI Code Generation

copy

Full Screen

1var mouse = page.Mouse;2await mouse.MoveAsync(0, 0);3await mouse.ClickAsync(100, 100);4var mouse = page.Mouse;5await mouse.MoveAsync(0, 0);6await mouse.ClickAsync(100, 100);7var mouse = page.Mouse;8await mouse.MoveAsync(0, 0);9await mouse.ClickAsync(100, 100);10var mouse = page.Mouse;11await mouse.MoveAsync(0, 0);12await mouse.ClickAsync(100, 100);13var mouse = page.Mouse;14await mouse.MoveAsync(0, 0);15await mouse.ClickAsync(100, 100);16var mouse = page.Mouse;17await mouse.MoveAsync(0, 0);18await mouse.ClickAsync(100, 100);19var mouse = page.Mouse;20await mouse.MoveAsync(0, 0);21await mouse.ClickAsync(100, 100);22var mouse = page.Mouse;23await mouse.MoveAsync(0, 0);24await mouse.ClickAsync(100, 100);25var mouse = page.Mouse;26await mouse.MoveAsync(0, 0);27await mouse.ClickAsync(100, 100);28var mouse = page.Mouse;29await mouse.MoveAsync(0, 0);30await mouse.ClickAsync(100, 100);31var mouse = page.Mouse;32await mouse.MoveAsync(0, 0);33await mouse.ClickAsync(100, 100);

Full Screen

Full Screen

Mouse

Using AI Code Generation

copy

Full Screen

1using PuppeteerSharp.Input;2var mouse = page.Mouse;3await mouse.MoveAsync(1, 2);4await mouse.ClickAsync(3, 4, MouseButton.Left);5await mouse.ClickAsync(3, 4, MouseButton.Right);6await mouse.ClickAsync(3, 4, MouseButton.Middle);7await mouse.DownAsync(MouseButton.Left);8await mouse.UpAsync(MouseButton.Left);9await mouse.MoveAsync(1, 2, new MouseOptions { Steps = 10 });10await mouse.MoveAsync(1, 2, new MouseOptions { Steps = 10, Delay = 1000 });11await mouse.WheelAsync(0, 100);12await mouse.WheelAsync(0, -100);13using PuppeteerSharp.Input;14var keyboard = page.Keyboard;15await keyboard.PressAsync("ArrowLeft");16await keyboard.PressAsync("ArrowRight");17await keyboard.PressAsync("Enter");18await keyboard.PressAsync("Tab");19await keyboard.PressAsync("a");20await keyboard.PressAsync("A");21await keyboard.PressAsync("!");22await keyboard.PressAsync("1");23await keyboard.PressAsync("Shift");24await keyboard.PressAsync("Control");25await keyboard.PressAsync("Alt");26await keyboard.PressAsync("Meta");27await keyboard.PressAsync("Escape");28await keyboard.PressAsync("Backspace");29await keyboard.PressAsync("Delete");30await keyboard.PressAsync("F1");31await keyboard.PressAsync("F12");32await keyboard.PressAsync("Home");33await keyboard.PressAsync("End");34await keyboard.PressAsync("PageUp");35await keyboard.PressAsync("PageDown");36await keyboard.PressAsync("Insert");37await keyboard.PressAsync("NumLock");38await keyboard.PressAsync("Numpad0");39await keyboard.PressAsync("Numpad1");40await keyboard.PressAsync("Numpad2");41await keyboard.PressAsync("Numpad3");42await keyboard.PressAsync("Numpad4");43await keyboard.PressAsync("Numpad5");44await keyboard.PressAsync("Numpad6");45await keyboard.PressAsync("Numpad7");46await keyboard.PressAsync("Numpad8");47await keyboard.PressAsync("Numpad9");48await keyboard.PressAsync("NumpadAdd");49await keyboard.PressAsync("Numpad

Full Screen

Full Screen

Mouse

Using AI Code Generation

copy

Full Screen

1using PuppeteerSharp.Input;2using PuppeteerSharp.Input;3var mouse = new Mouse();4await mouse.ClickAsync();5await mouse.MoveAsync();6using PuppeteerSharp.Input;7var mouse = new Mouse();8await mouse.ClickAsync();9await mouse.MoveAsync();10using PuppeteerSharp.Input;11var mouse = new Mouse();12await mouse.ClickAsync();13await mouse.MoveAsync();14using PuppeteerSharp.Input;15var mouse = new Mouse();16await mouse.ClickAsync();17await mouse.MoveAsync();18using PuppeteerSharp.Input;19var mouse = new Mouse();20await mouse.ClickAsync();21await mouse.MoveAsync();22using PuppeteerSharp.Input;23var mouse = new Mouse();24await mouse.ClickAsync();25await mouse.MoveAsync();26using PuppeteerSharp.Input;27var mouse = new Mouse();28await mouse.ClickAsync();29await mouse.MoveAsync();30using PuppeteerSharp.Input;31var mouse = new Mouse();32await mouse.ClickAsync();33await mouse.MoveAsync();34using PuppeteerSharp.Input;35var mouse = new Mouse();36await mouse.ClickAsync();37await mouse.MoveAsync();38using PuppeteerSharp.Input;39var mouse = new Mouse();40await mouse.ClickAsync();41await mouse.MoveAsync();42using PuppeteerSharp.Input;43var mouse = new Mouse();44await mouse.ClickAsync();45await mouse.MoveAsync();46using PuppeteerSharp.Input;47var mouse = new Mouse();48await mouse.ClickAsync();49await mouse.MoveAsync();50using PuppeteerSharp.Input;51var mouse = new Mouse();52await mouse.ClickAsync();53await mouse.MoveAsync();54using PuppeteerSharp.Input;55var mouse = new Mouse();56await mouse.ClickAsync();57await mouse.MoveAsync();58using PuppeteerSharp.Input;59var mouse = new Mouse();60await mouse.ClickAsync();61await mouse.MoveAsync();62using PuppeteerSharp.Input;63var mouse = new Mouse();64await mouse.ClickAsync();65await mouse.MoveAsync();66using PuppeteerSharp.Input;67var mouse = new Mouse();

Full Screen

Full Screen

Mouse

Using AI Code Generation

copy

Full Screen

1using PuppeteerSharp.Input;2var mouse = page.Mouse;3await mouse.ClickAsync(100, 100);4await page.ScreenshotAsync("mouse-click.png");5using PuppeteerSharp.Input;6var mouse = page.Mouse;7await mouse.MoveAsync(100, 100);8await page.ScreenshotAsync("mouse-move.png");9ClickAsync()10DownAsync()11DoubleClickAsync()12MoveAsync()13UpAsync()14using PuppeteerSharp.Input;15var keyboard = page.Keyboard;16await keyboard.TypeAsync("Hello World");17await page.ScreenshotAsync("keyboard-type.png");18DownAsync()19PressAsync()20SendCharacterAsync()21SendCharactersAsync()22TypeAsync()23UpAsync()24using PuppeteerSharp.Input;25var touchscreen = page.Touchscreen;26await touchscreen.TapAsync(100, 100);27await page.ScreenshotAsync("touchscreen-tap.png");

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Puppeteer-sharp automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful