Merge pull request #297 from hchen2020/master

wait LoadState.NetworkIdle after button clicked.
This commit is contained in:
Haiping 2024-02-10 10:59:44 -06:00 committed by GitHub
commit 1b559f75be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View file

@ -8,7 +8,6 @@ public partial class PlaywrightWebDriver
{
await _instance.Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded);
await _instance.Page.WaitForLoadStateAsync(LoadState.NetworkIdle);
await Task.Delay(100);
// Find by text exactly match
@ -52,10 +51,11 @@ public partial class PlaywrightWebDriver
try
{
await elements.HoverAsync();
await elements.ClickAsync();
await Task.Delay(300);
await _instance.Page.WaitForLoadStateAsync(LoadState.NetworkIdle);
await Task.Delay(100);
return true;
}
catch (Exception ex)

View file

@ -9,6 +9,7 @@ public partial class PlaywrightWebDriver
{
await _instance.Page.WaitForLoadStateAsync(LoadState.DOMContentLoaded);
await _instance.Page.WaitForLoadStateAsync(LoadState.NetworkIdle);
await Task.Delay(100);
// Retrieve the page raw html and infer the element path
var regexExpression = actionParams.Context.MatchRule.ToLower() switch
@ -37,11 +38,11 @@ public partial class PlaywrightWebDriver
{
// var tagName = await elements.EvaluateAsync<string>("el => el.tagName");
await elements.HoverAsync();
await elements.ClickAsync();
// Triggered ajax
await _instance.Page.WaitForLoadStateAsync(LoadState.NetworkIdle);
await Task.Delay(100);
return true;
}