File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
PuppeteerSharp.Tests/BrowserTests Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 1+ using System . Threading . Tasks ;
2+ using Xunit ;
3+ using Xunit . Abstractions ;
4+
5+ namespace PuppeteerSharp . Tests . BrowserTests
6+ {
7+ [ Collection ( "PuppeteerLoaderFixture collection" ) ]
8+ public class TargetTests : PuppeteerBrowserBaseTest
9+ {
10+ public TargetTests ( ITestOutputHelper output ) : base ( output )
11+ {
12+ }
13+
14+ [ Fact ]
15+ public void ShouldReturnBrowserTarget ( )
16+ => Assert . Equal ( TargetType . Browser , Browser . Target . Type ) ;
17+ }
18+ }
Original file line number Diff line number Diff line change @@ -164,6 +164,11 @@ public Browser(
164164 /// <returns>An Array of all active targets</returns>
165165 public Target [ ] Targets ( ) => TargetsMap . Values . Where ( target => target . IsInitialized ) . ToArray ( ) ;
166166
167+ /// <summary>
168+ /// A target associated with the browser.
169+ /// </summary>
170+ public Target Target => Targets ( ) . FirstOrDefault ( t => t . Type == TargetType . Browser ) ;
171+
167172 /// <summary>
168173 /// Creates a new incognito browser context. This won't share cookies/cache with other browser contexts.
169174 /// </summary>
You can’t perform that action at this time.
0 commit comments