diff --git a/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.GoToPage.cs b/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.GoToPage.cs index 44916a89..2f339ca6 100644 --- a/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.GoToPage.cs +++ b/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.GoToPage.cs @@ -8,7 +8,7 @@ public partial class PlaywrightWebDriver var context = await _instance.GetContext(message.ContextId); try { - var page = await _instance.NewPage(message, enableResponseCallback: args.EnableResponseCallback, + var page = await _instance.NewPage(message, enableResponseCallback: args.EnableResponseCallback, responseInMemory: args.ResponseInMemory, responseContainer: args.ResponseContainer, excludeResponseUrls: args.ExcludeResponseUrls, @@ -18,7 +18,7 @@ public partial class PlaywrightWebDriver if (args.OpenNewTab && page != null && page.Url == "about:blank") { - page = await _instance.NewPage(message, + page = await _instance.NewPage(message, enableResponseCallback: args.EnableResponseCallback, responseInMemory: args.ResponseInMemory, responseContainer: args.ResponseContainer, @@ -28,7 +28,7 @@ public partial class PlaywrightWebDriver if (page == null) { - page = await _instance.NewPage(message, + page = await _instance.NewPage(message, enableResponseCallback: args.EnableResponseCallback, responseInMemory: args.ResponseInMemory, responseContainer: args.ResponseContainer, @@ -47,7 +47,7 @@ public partial class PlaywrightWebDriver if (args.Selectors != null) { // 使用传入的选择器列表进行并行等待 - var tasks =args.Selectors.Select(selector => + var tasks = args.Selectors.Select(selector => page.WaitForSelectorAsync(selector, new PageWaitForSelectorOptions { Timeout = args.Timeout > 0 ? args.Timeout : 30000 @@ -92,7 +92,7 @@ public partial class PlaywrightWebDriver } } else - { + { result.Message = response.StatusText; } } diff --git a/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.ScrollPage.cs b/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.ScrollPage.cs index 48538ce8..3919629e 100644 --- a/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.ScrollPage.cs +++ b/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.ScrollPage.cs @@ -5,7 +5,8 @@ public partial class PlaywrightWebDriver public async Task ScrollPage(MessageInfo message, PageActionArgs args) { var result = new BrowserActionResult(); - await _instance.Wait(message.ContextId); + var waitTime = args.WaitTime > 0 ? args.WaitTime : 10; + await _instance.Wait(message.ContextId, waitTime, args.WaitForNetworkIdle); var page = _instance.GetPage(message.ContextId); @@ -31,7 +32,7 @@ public partial class PlaywrightWebDriver int scrollY = await page.EvaluateAsync("document.body.scrollHeight"); // Scroll to the bottom - await page.Mouse.WheelAsync(0, -scrollY); + await page.Mouse.WheelAsync(0, scrollY); } else if (args.Direction == "top") {