From 0dcb9f8c6e4d4be38198941e4968e8fb8d387b49 Mon Sep 17 00:00:00 2001 From: AnonymousDotNet <18776095145@163.com> Date: Wed, 21 Aug 2024 17:12:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9Locator=E5=8C=B9=E9=85=8D?= =?UTF-8?q?=E5=88=B0=E5=A4=9A=E4=B8=AA=E6=97=B6=E5=8F=96=E7=AC=AC=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Drivers/PlaywrightDriver/PlaywrightWebDriver.DoAction.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.DoAction.cs b/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.DoAction.cs index 91766736..08ce88e8 100644 --- a/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.DoAction.cs +++ b/src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.DoAction.cs @@ -11,7 +11,7 @@ public partial class PlaywrightWebDriver return; } - ILocator locator = page.Locator(result.Selector); + ILocator locator = page.Locator(result.Selector).First;// 匹配到多个时取第一个,否则当await locator.ClickAsync();匹配到多个就会抛异常。 var count = await locator.CountAsync(); if (count == 0) {