Skip to content

Commit 8d25d8e

Browse files
authored
Document the world (#304)
1 parent ff4e3ff commit 8d25d8e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1414
-217
lines changed

lib/PuppeteerSharp/BoundingBox.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
namespace PuppeteerSharp
55
{
6+
/// <summary>
7+
/// Bounding box data returned by <see cref="ElementHandle.BoundingBoxAsync"/>.
8+
/// </summary>
69
public class BoundingBox
710
{
811
/// <summary>
@@ -26,6 +29,13 @@ public class BoundingBox
2629
/// <value>The height.</value>
2730
public decimal Height { get; set; }
2831

32+
/// <summary>
33+
/// Initializes a new instance of the <see cref="BoundingBox"/> class.
34+
/// </summary>
35+
/// <param name="x">The x coordinate.</param>
36+
/// <param name="y">The y coordinate.</param>
37+
/// <param name="width">Width.</param>
38+
/// <param name="height">Height.</param>
2939
public BoundingBox(decimal x, decimal y, decimal width, decimal height)
3040
{
3141
X = x;
@@ -45,6 +55,7 @@ internal Clip ToClip()
4555
};
4656
}
4757

58+
/// <inheritdoc/>
4859
public override bool Equals(object obj)
4960
{
5061
if (obj == null && GetType() != obj.GetType())
@@ -60,6 +71,7 @@ public override bool Equals(object obj)
6071
boundingBox.Width == Width;
6172
}
6273

74+
/// <inheritdoc/>
6375
public override int GetHashCode()
6476
=> X.GetHashCode() * 397
6577
^ Y.GetHashCode() * 397

lib/PuppeteerSharp/Browser.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Diagnostics;
44
using System.Linq;
55
using System.Threading.Tasks;
6+
using Microsoft.Extensions.Logging;
67
using PuppeteerSharp.Helpers;
78

89
namespace PuppeteerSharp
@@ -87,13 +88,13 @@ public Browser(Connection connection, IBrowserOptions options, Process process,
8788
/// <summary>
8889
/// Raised when a target is destroyed, for example when a page is closed
8990
/// </summary>
90-
public event EventHandler<TargetChangedArgs> TargetDestroyed;
91+
public event EventHandler<TargetChangedArgs> TargetDestroyed;
9192

9293
/// <summary>
9394
/// Gets the Browser websocket url
9495
/// </summary>
9596
/// <remarks>
96-
/// Browser websocket endpoint which can be used as an argument to <see cref="Puppeteer.ConnectAsync(ConnectOptions)"/>.
97+
/// Browser websocket endpoint which can be used as an argument to <see cref="Puppeteer.ConnectAsync(ConnectOptions, ILoggerFactory)"/>.
9798
/// The format is <c>ws://${host}:${port}/devtools/browser/[id]</c>
9899
/// You can find the <c>webSocketDebuggerUrl</c> from <c>http://${host}:${port}/json/version</c>.
99100
/// Learn more about the devtools protocol <see href="https://chromedevtools.github.io/devtools-protocol"/>
@@ -102,7 +103,7 @@ public Browser(Connection connection, IBrowserOptions options, Process process,
102103
public string WebSocketEndpoint => Connection.Url;
103104

104105
/// <summary>
105-
/// Gets the spawned browser process. Returns <c>null</c> if the browser instance was created with <see cref="Puppeteer.ConnectAsync(ConnectOptions)"/> method.
106+
/// Gets the spawned browser process. Returns <c>null</c> if the browser instance was created with <see cref="Puppeteer.ConnectAsync(ConnectOptions, ILoggerFactory)"/> method.
106107
/// </summary>
107108
public Process Process { get; }
108109

@@ -155,7 +156,7 @@ public async Task<Page> NewPageAsync()
155156
/// <returns>Task which resolves to an array of all open pages.</returns>
156157
public async Task<Page[]> PagesAsync()
157158
=> (await Task.WhenAll(Targets().Select(target => target.PageAsync()))).Where(x => x != null).ToArray();
158-
159+
159160
/// <summary>
160161
/// Gets the browser's version
161162
/// </summary>

lib/PuppeteerSharp/CDPSession.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ internal CDPSession(Connection connection, string targetId, string sessionId)
7676
/// </summary>
7777
public event EventHandler<TracingCompleteEventArgs> TracingComplete;
7878
/// <summary>
79-
/// Gets or sets a value indicating whether this <see cref="T:PuppeteerSharp.CDPSession"/> is closed.
79+
/// Gets or sets a value indicating whether this <see cref="CDPSession"/> is closed.
8080
/// </summary>
8181
/// <value><c>true</c> if is closed; otherwise, <c>false</c>.</value>
8282
public bool IsClosed { get; internal set; }
@@ -151,14 +151,14 @@ public Task DetachAsync()
151151
#region Private Methods
152152

153153
/// <summary>
154-
/// Releases all resource used by the <see cref="T:PuppeteerSharp.CDPSession"/> object by sending a ""Target.closeTarget"
154+
/// Releases all resource used by the <see cref="CDPSession"/> object by sending a ""Target.closeTarget"
155155
/// using the <see cref="Connection.SendAsync(string, dynamic)"/> method.
156156
/// </summary>
157-
/// <remarks>Call <see cref="Dispose"/> when you are finished using the <see cref="PuppeteerSharp.CDPSession"/>. The
158-
/// <see cref="Dispose"/> method leaves the <see cref="PuppeteerSharp.CDPSession"/> in an unusable state.
157+
/// <remarks>Call <see cref="Dispose"/> when you are finished using the <see cref="CDPSession"/>. The
158+
/// <see cref="Dispose"/> method leaves the <see cref="CDPSession"/> in an unusable state.
159159
/// After calling <see cref="Dispose"/>, you must release all references to the
160-
/// <see cref="PuppeteerSharp.CDPSession"/> so the garbage collector can reclaim the memory that the
161-
/// <see cref="PuppeteerSharp.CDPSession"/> was occupying.</remarks>
160+
/// <see cref="CDPSession"/> so the garbage collector can reclaim the memory that the
161+
/// <see cref="CDPSession"/> was occupying.</remarks>
162162
public void Dispose()
163163
{
164164
Connection.SendAsync("Target.closeTarget", new Dictionary<string, object>

lib/PuppeteerSharp/ChromeProcessException.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,26 @@
22

33
namespace PuppeteerSharp
44
{
5+
/// <summary>
6+
/// Chrome process exception thrown by <see cref="Launcher"/>.
7+
/// </summary>
58
public class ChromeProcessException : PuppeteerException
69
{
10+
/// <summary>
11+
/// Initializes a new instance of the <see cref="ChromeProcessException"/> class.
12+
/// </summary>
13+
/// <param name="message">Message.</param>
714
public ChromeProcessException(string message) : base(message)
815
{
916
}
1017

18+
/// <summary>
19+
/// Initializes a new instance of the <see cref="ChromeProcessException"/> class.
20+
/// </summary>
21+
/// <param name="message">Message.</param>
22+
/// <param name="innerException">Inner exception.</param>
1123
public ChromeProcessException(string message, Exception innerException) : base(message, innerException)
1224
{
13-
1425
}
1526
}
1627
}

lib/PuppeteerSharp/Connection.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ internal Connection(string url, int delay, ClientWebSocket ws, ILoggerFactory lo
7373
/// </summary>
7474
public event EventHandler<MessageEventArgs> MessageReceived;
7575
/// <summary>
76-
/// Gets or sets a value indicating whether this <see cref="PuppeteerSharp.Connection"/> is closed.
76+
/// Gets or sets a value indicating whether this <see cref="Connection"/> is closed.
7777
/// </summary>
7878
/// <value><c>true</c> if is closed; otherwise, <c>false</c>.</value>
7979
public bool IsClosed { get; internal set; }
@@ -278,14 +278,14 @@ internal static async Task<Connection> Create(string url, int delay = 0, int kee
278278
}
279279

280280
/// <summary>
281-
/// Releases all resource used by the <see cref="PuppeteerSharp.Connection"/> object.
281+
/// Releases all resource used by the <see cref="Connection"/> object.
282282
/// It will raise the <see cref="Closed"/> event and call <see cref="WebSocket.CloseAsync(WebSocketCloseStatus, string, CancellationToken)"/>.
283283
/// </summary>
284-
/// <remarks>Call <see cref="Dispose"/> when you are finished using the <see cref="PuppeteerSharp.Connection"/>. The
285-
/// <see cref="Dispose"/> method leaves the <see cref="T:PuppeteerSharp.Connection"/> in an unusable state.
284+
/// <remarks>Call <see cref="Dispose"/> when you are finished using the <see cref="Connection"/>. The
285+
/// <see cref="Dispose"/> method leaves the <see cref="Connection"/> in an unusable state.
286286
/// After calling <see cref="Dispose"/>, you must release all references to the
287-
/// <see cref="PuppeteerSharp.Connection"/> so the garbage collector can reclaim the memory that the
288-
/// <see cref="PuppeteerSharp.Connection"/> was occupying.</remarks>
287+
/// <see cref="Connection"/> so the garbage collector can reclaim the memory that the
288+
/// <see cref="Connection"/> was occupying.</remarks>
289289
public void Dispose()
290290
{
291291
OnClose();

lib/PuppeteerSharp/ConsoleEventArgs.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,21 @@
22

33
namespace PuppeteerSharp
44
{
5+
/// <summary>
6+
/// <see cref="Page.Console"/> data.
7+
/// </summary>
58
public class ConsoleEventArgs : EventArgs
69
{
10+
/// <summary>
11+
/// Gets the message.
12+
/// </summary>
13+
/// <value>The message.</value>
714
public ConsoleMessage Message { get; }
815

16+
/// <summary>
17+
/// Initializes a new instance of the <see cref="ConsoleEventArgs"/> class.
18+
/// </summary>
19+
/// <param name="message">Message.</param>
920
public ConsoleEventArgs(ConsoleMessage message) => Message = message;
1021
}
1122
}

lib/PuppeteerSharp/ConsoleMessage.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,33 @@
22

33
namespace PuppeteerSharp
44
{
5+
/// <summary>
6+
/// ConsoleMessage is part of <see cref="ConsoleEventArgs"/> used by <see cref="Page.Console"/>
7+
/// </summary>
58
public class ConsoleMessage
69
{
10+
/// <summary>
11+
/// Gets the ConsoleMessage type.
12+
/// </summary>
13+
/// <value>ConsoleMessageType.</value>
714
public ConsoleType Type { get; }
15+
/// <summary>
16+
/// Gets the console text.
17+
/// </summary>
18+
/// <value>The text.</value>
819
public string Text { get; }
20+
/// <summary>
21+
/// Gets the arguments.
22+
/// </summary>
23+
/// <value>The arguments.</value>
924
public IList<JSHandle> Args { get; }
1025

26+
/// <summary>
27+
/// Initializes a new instance of the <see cref="ConsoleMessage"/> class.
28+
/// </summary>
29+
/// <param name="type">Type.</param>
30+
/// <param name="text">Text.</param>
31+
/// <param name="args">Arguments.</param>
1132
public ConsoleMessage(ConsoleType type, string text, IList<JSHandle> args)
1233
{
1334
Type = type;

lib/PuppeteerSharp/ConsoleType.cs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,81 @@
11
namespace PuppeteerSharp
22
{
3+
/// <summary>
4+
/// Console type used on <see cref="ConsoleMessage"/>.
5+
/// </summary>
36
public enum ConsoleType
47
{
8+
/// <summary>
9+
/// Log.
10+
/// </summary>
511
Log,
12+
/// <summary>
13+
/// Debug.
14+
/// </summary>
615
Debug,
16+
/// <summary>
17+
/// Info.
18+
/// </summary>
719
Info,
20+
/// <summary>
21+
/// Error.
22+
/// </summary>
823
Error,
24+
/// <summary>
25+
/// Warning.
26+
/// </summary>
927
Warning,
28+
/// <summary>
29+
/// Dir.
30+
/// </summary>
1031
Dir,
32+
/// <summary>
33+
/// Dirxml.
34+
/// </summary>
1135
Dirxml,
36+
/// <summary>
37+
/// Table.
38+
/// </summary>
1239
Table,
40+
/// <summary>
41+
/// Trace.
42+
/// </summary>
1343
Trace,
44+
/// <summary>
45+
/// Clear.
46+
/// </summary>
1447
Clear,
48+
/// <summary>
49+
/// StartGroup.
50+
/// </summary>
1551
StartGroup,
52+
/// <summary>
53+
/// StartGroupCollapsed.
54+
/// </summary>
1655
StartGroupCollapsed,
56+
/// <summary>
57+
/// EndGroup.
58+
/// </summary>
1759
EndGroup,
60+
/// <summary>
61+
/// Assert.
62+
/// </summary>
1863
Assert,
64+
/// <summary>
65+
/// Profile.
66+
/// </summary>
1967
Profile,
68+
/// <summary>
69+
/// ProfileEnd.
70+
/// </summary>
2071
ProfileEnd,
72+
/// <summary>
73+
/// Count.
74+
/// </summary>
2175
Count,
76+
/// <summary>
77+
/// TimeEnd.
78+
/// </summary>
2279
TimeEnd,
2380
}
2481
}
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
namespace PuppeteerSharp
22
{
3-
public class ContextPayload
3+
internal class ContextPayload
44
{
5-
public ContextPayload(dynamic context)
5+
internal ContextPayload(dynamic context)
66
{
77
Id = context.id;
88
AuxData = context.auxData.ToObject<ContextPayloadAuxData>();
99
}
1010

11-
public int Id { get; internal set; }
12-
13-
public ContextPayloadAuxData AuxData { get; internal set; }
11+
internal int Id { get; }
12+
internal ContextPayloadAuxData AuxData { get; }
1413
}
1514
}
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
using Newtonsoft.Json;
2+
13
namespace PuppeteerSharp
24
{
3-
public struct ContextPayloadAuxData
5+
internal struct ContextPayloadAuxData
46
{
5-
public string FrameId { get; set; }
6-
public bool IsDefault { get; set; }
7+
[JsonProperty("frameId")]
8+
internal string FrameId { get; set; }
9+
[JsonProperty("isDefault")]
10+
internal bool IsDefault { get; set; }
711
}
812
}

0 commit comments

Comments
 (0)