Skip to content

Commit

Permalink
Add Page.BrowserContext (#895)
Browse files Browse the repository at this point in the history
  • Loading branch information
Meir017 authored and kblok committed Feb 2, 2019
1 parent 56f1237 commit e764317
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/PuppeteerSharp.Tests/PageTests/BrowserContextTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Xunit;
using Xunit.Abstractions;

namespace PuppeteerSharp.Tests.PageTests
{
[Collection("PuppeteerLoaderFixture collection")]
public class BrowserContextTests : PuppeteerPageBaseTest
{
public BrowserContextTests(ITestOutputHelper output) : base(output)
{
}

[Fact]
public void ShouldReturnTheCorrectBrowserInstance() => Assert.Same(Context, Page.BrowserContext);
}
}
5 changes: 5 additions & 0 deletions lib/PuppeteerSharp/Page.cs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,11 @@ public int DefaultNavigationTimeout
/// </summary>
public Browser Browser => Target.Browser;

/// <summary>
/// Get the browser context that the page belongs to.
/// </summary>
public BrowserContext BrowserContext => Target.BrowserContext;

/// <summary>
/// Get an indication that the page has been closed.
/// </summary>
Expand Down

0 comments on commit e764317

Please sign in to comment.