From e27d3764a614113e555064eda5720d1a0e9f6276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dari=CC=81o=20Kondratiuk?= Date: Mon, 16 Dec 2019 07:56:04 -0300 Subject: [PATCH] Add response example --- lib/PuppeteerSharp/Page.cs | 20 ++++++++++++++++++++ lib/PuppeteerSharp/Response.cs | 5 +++++ 2 files changed, 25 insertions(+) mode change 100755 => 100644 lib/PuppeteerSharp/Response.cs diff --git a/lib/PuppeteerSharp/Page.cs b/lib/PuppeteerSharp/Page.cs index dc2e25286..60081bfd4 100644 --- a/lib/PuppeteerSharp/Page.cs +++ b/lib/PuppeteerSharp/Page.cs @@ -165,6 +165,26 @@ private Page( /// /// Raised when a is received. /// + /// + /// An example of handling event: + /// + /// (); + /// page.Response += async(sender, e) => + /// { + /// if (e.Response.Url.Contains("script.js")) + /// { + /// tcs.TrySetResult(await e.Response.TextAsync()); + /// } + /// }; + /// + /// await Task.WhenAll( + /// page.GoToAsync(TestConstants.ServerUrl + "/grid.html"), + /// tcs.Task); + /// Console.WriteLine(await tcs.Task); + /// ]]> + /// + /// public event EventHandler Response; /// diff --git a/lib/PuppeteerSharp/Response.cs b/lib/PuppeteerSharp/Response.cs old mode 100755 new mode 100644 index d3b1a00e9..cadae95a7 --- a/lib/PuppeteerSharp/Response.cs +++ b/lib/PuppeteerSharp/Response.cs @@ -12,6 +12,11 @@ namespace PuppeteerSharp /// /// class represents responses which are received by page. /// + /// + /// + /// + /// + /// public class Response { private readonly CDPSession _client;