Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -893,21 +893,6 @@
"FAIL"
]
},
{
"comment": "This is part of organizing the webdriver bidi implementation, We will remove it one by one",
"testIdPattern": "[page.spec] *Page.close*",
"platforms": [
"darwin",
"linux",
"win32"
],
"parameters": [
"webDriverBiDi"
],
"expectations": [
"FAIL"
]
},
{
"comment": "This is part of organizing the webdriver bidi implementation, We will remove it one by one",
"testIdPattern": "[page.spec] *Page.exposeFunction*",
Expand Down
15 changes: 14 additions & 1 deletion lib/PuppeteerSharp/Bidi/BidiBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ private BidiBrowser(Core.Browser browserCore, LaunchOptions options, ILoggerFact
public override Task<string> GetUserAgentAsync() => Task.FromResult(BrowserCore.Session.Info.Capabilities.UserAgent);

/// <inheritdoc />
public override void Disconnect() => throw new NotImplementedException();
public override void Disconnect()
{
Driver.StopAsync().GetAwaiter().GetResult();
Detach();
}

/// <inheritdoc />
public override async Task CloseAsync()
Expand Down Expand Up @@ -187,6 +191,15 @@ private void InitializeAsync()
}
}

private void Detach()
{
foreach (var context in _browserContexts)
{
context.TargetCreated -= (sender, args) => OnTargetCreated(args);
context.TargetDestroyed -= (sender, args) => OnTargetDestroyed(args);
}
}

private BidiBrowserContext CreateBrowserContext(UserContext userContext)
{
var browserContext = BidiBrowserContext.From(
Expand Down
Loading