diff --git a/lib/PuppeteerSharp.Tests/PageTests/BrowserContextTests.cs b/lib/PuppeteerSharp.Tests/PageTests/BrowserContextTests.cs new file mode 100644 index 000000000..5a946bca6 --- /dev/null +++ b/lib/PuppeteerSharp.Tests/PageTests/BrowserContextTests.cs @@ -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); + } +} \ No newline at end of file diff --git a/lib/PuppeteerSharp/Page.cs b/lib/PuppeteerSharp/Page.cs index ea518a2ed..50cd20357 100644 --- a/lib/PuppeteerSharp/Page.cs +++ b/lib/PuppeteerSharp/Page.cs @@ -296,6 +296,11 @@ public int DefaultNavigationTimeout /// public Browser Browser => Target.Browser; + /// + /// Get the browser context that the page belongs to. + /// + public BrowserContext BrowserContext => Target.BrowserContext; + /// /// Get an indication that the page has been closed. ///