Skip to content

Commit

Permalink
Rename puppeteer util
Browse files Browse the repository at this point in the history
  • Loading branch information
kblok committed Apr 15, 2023
1 parent 4846607 commit 347a69f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public async Task ShouldThrowIfUnderlyingElementWasDisposed()
var element = await Page.QuerySelectorAsync("section");
Assert.NotNull(element);
await element.DisposeAsync();
var exception = await Assert.ThrowsAsync<EvaluationFailedException>(()
var exception = await Assert.ThrowsAnyAsync<PuppeteerException>(()
=> Page.EvaluateFunctionAsync<string>("e => e.textContent", element));
Assert.Contains("JSHandle is disposed", exception.Message);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/PuppeteerSharp.Tests/InjectedTests/InjectedTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public async Task ShouldWork()
PuppeteerUtil => {
return typeof PuppeteerUtil === 'object';
}",
await world.PuppeteerUtil);
await world.GetPuppeteerUtilAsync());
Assert.True(result);
}

Expand All @@ -37,7 +37,7 @@ public async Task CreateFunctionShouldWork()
.PuppeteerWorld.EvaluateFunctionAsync<int>(@"({createFunction}, fnString) => {
return createFunction(fnString)(4);
}",
await world.PuppeteerUtil,
await world.GetPuppeteerUtilAsync(),
"() => 4");
Assert.Equal(4, result);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/PuppeteerSharp/Frame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public async Task<IElementHandle> AddStyleTagAsync(AddTagOptions options)
await promise;
return element;
}",
await PuppeteerWorld.PuppeteerUtil.ConfigureAwait(false),
await PuppeteerWorld.GetPuppeteerUtilAsync().ConfigureAwait(false),
options.Url,
options.Id,
options.Type,
Expand Down Expand Up @@ -300,7 +300,7 @@ public async Task<IElementHandle> AddScriptTagAsync(AddTagOptions options)
await promise;
return script;
}",
await PuppeteerWorld.PuppeteerUtil.ConfigureAwait(false),
await PuppeteerWorld.GetPuppeteerUtilAsync().ConfigureAwait(false),
options.Url,
options.Id,
options.Type,
Expand Down
2 changes: 1 addition & 1 deletion lib/PuppeteerSharp/IsolatedWorld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public IsolatedWorld(

internal TaskCompletionSource<IJSHandle> PuppeteerUtilTaskCompletionSource { get; private set; } = new(TaskCreationOptions.RunContinuationsAsynchronously);

internal Task<IJSHandle> PuppeteerUtil => PuppeteerUtilTaskCompletionSource.Task;
internal Task<IJSHandle> GetPuppeteerUtilAsync() => PuppeteerUtilTaskCompletionSource.Task;

internal async Task AddBindingToContextAsync(ExecutionContext context, string name)
{
Expand Down

0 comments on commit 347a69f

Please sign in to comment.