add waitNetworkIdle
This commit is contained in:
parent
f7c77ee11c
commit
8ddb0d4ace
|
|
@ -203,15 +203,18 @@ public class PlaywrightInstance : IDisposable
|
|||
/// <param name="ctxId"></param>
|
||||
/// <param name="timeout">seconds</param>
|
||||
/// <returns></returns>
|
||||
public async Task Wait(string ctxId, int timeout = 60)
|
||||
public async Task Wait(string ctxId, int timeout = 10, bool waitNetworkIdle = true)
|
||||
{
|
||||
foreach (var page in _pages[ctxId])
|
||||
{
|
||||
await page.WaitForLoadStateAsync(LoadState.DOMContentLoaded);
|
||||
await page.WaitForLoadStateAsync(LoadState.NetworkIdle, new PageWaitForLoadStateOptions
|
||||
if (waitNetworkIdle)
|
||||
{
|
||||
Timeout = 1000 * timeout
|
||||
});
|
||||
await page.WaitForLoadStateAsync(LoadState.NetworkIdle, new PageWaitForLoadStateOptions
|
||||
{
|
||||
Timeout = 1000 * timeout
|
||||
});
|
||||
}
|
||||
}
|
||||
await Task.Delay(100);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ public partial class PlaywrightWebDriver
|
|||
{
|
||||
public async Task<BrowserActionResult> ActionOnElement(MessageInfo message, ElementLocatingArgs location, ElementActionArgs action)
|
||||
{
|
||||
await _instance.Wait(message.ContextId);
|
||||
await _instance.Wait(message.ContextId, waitNetworkIdle: false);
|
||||
var result = await LocateElement(message, location);
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue