Skip to content

Commit 0e00fce

Browse files
committed
fix
1 parent 319e0f5 commit 0e00fce

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lib/PuppeteerSharp.Tests/BrowserContextTests/DefaultBrowserContextTests.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ namespace PuppeteerSharp.Tests.BrowserContextTests
77
{
88
public class DefaultBrowserContextTests : PuppeteerPageBaseTest
99
{
10-
public DefaultBrowserContextTests() : base()
11-
{
12-
}
13-
1410
[SetUp]
1511
public async Task CreateNewPageAsync()
1612
{

lib/PuppeteerSharp/Bidi/BidiBrowserContext.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ internal static BidiBrowserContext From(
9999
UserContext userContext,
100100
BidiBrowserContextOptions options)
101101
{
102-
var context = new BidiBrowserContext(browser, userContext, options);
102+
var context = new BidiBrowserContext(browser, userContext, options)
103+
{
104+
Id = userContext.Id,
105+
};
103106
context.Initialize();
104107
return context;
105108
}

lib/PuppeteerSharp/Bidi/Core/Browser.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
using System;
2424
using System.Collections.Concurrent;
2525
using System.Collections.Generic;
26+
using System.Linq;
2627
using System.Threading.Tasks;
2728
using PuppeteerSharp.Helpers;
2829
using WebDriverBiDi.Browser;
@@ -49,7 +50,7 @@ internal sealed class Browser(Session session) : IDisposable
4950

5051
public string Reason { get; set; }
5152

52-
internal UserContext DefaultUserContext => _userContexts[UserContext.DEFAULT];
53+
internal UserContext DefaultUserContext => _userContexts.TryGetValue(UserContext.DEFAULT, out var context) ? context : _userContexts.Values.FirstOrDefault();
5354

5455
internal ICollection<UserContext> UserContexts => _userContexts.Values;
5556

0 commit comments

Comments
 (0)