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 @@ -153,21 +153,6 @@
"parameters": ["firefox"],
"expectations": ["FAIL"]
},
{
"comment": "This is part of organizing the webdriver bidi implementation, We will remove it one by one",
"testIdPattern": "[navigation.spec] navigation Page.waitForNavigation*should work with clicking on anchor links",
"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": "[navigation.spec] *should wait for network idle to succeed navigation*",
Expand Down Expand Up @@ -618,21 +603,6 @@
"FAIL"
]
},
{
"comment": "This is part of organizing the webdriver bidi implementation, We will remove it one by one",
"testIdPattern": "[click.spec] *",
"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": "[network.spec] *",
Expand Down
19 changes: 5 additions & 14 deletions lib/PuppeteerSharp/Bidi/BidiFrame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,25 +309,16 @@ await Task.WhenAny(
}

// If there's no request associated with this navigation after waiting,
// it means this is either:
// 1. A special URL like about:blank (no network request) - return null
// 2. A cached history navigation (GoBack/GoForward) - create synthetic response
// return null. This matches upstream behavior where:
// 1. Same-document navigations (fragment/anchor links) have no network request
// 2. Special URLs like about:blank have no network request
// 3. History navigations (GoBack/GoForward) may have no request
// See: https://github.com/w3c/webdriver-bidi/issues/502
var request = navigation.Request;

if (request == null)
{
var url = BrowsingContext.Url;

// Special URLs like about:blank don't have network requests
if (url.StartsWith("about:", StringComparison.OrdinalIgnoreCase) ||
url.StartsWith("data:", StringComparison.OrdinalIgnoreCase))
{
return null;
}

// For cached history navigations, create a synthetic response
return BidiHttpResponse.FromCachedNavigation(url);
return null;
}

var lastRequest = request.LastRedirect ?? request;
Expand Down
10 changes: 9 additions & 1 deletion lib/PuppeteerSharp/WaitTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ internal async Task RerunAsync()
}

// Note that FrameWaitForFunctionTests listen for this particular message to orchestrate the test execution
await _poller.EvaluateFunctionAsync("poller => poller.start()").ConfigureAwait(false);
// Using void to not await the start promise - matches upstream behavior
await _poller.EvaluateFunctionAsync("poller => { void poller.start(); }").ConfigureAwait(false);

var success = await _poller.EvaluateFunctionHandleAsync("poller => poller.result()").ConfigureAwait(false);
_result.TrySetResult(success);
Expand Down Expand Up @@ -228,6 +229,13 @@ private Exception GetBadException(Exception exception)
return null;
}

// Errors coming from WebDriver BiDi. TODO: Adjust messages after
// https://github.com/w3c/webdriver-bidi/issues/540 is resolved.
if (exception.Message.Contains("DiscardedBrowsingContextError"))
{
return null;
}

return exception;
}

Expand Down
Loading