Update dropdown selection based on PressKey

This commit is contained in:
vguruparan 2025-08-20 14:11:10 -05:00
parent 524c7ffcc8
commit 3081a0e197

View file

@ -63,6 +63,13 @@ public partial class PlaywrightWebDriver
else else
{ {
await locator.ClickAsync(); await locator.ClickAsync();
if (!string.IsNullOrWhiteSpace(action.PressKey))
{
await page.Keyboard.PressAsync(action.PressKey);
await page.Keyboard.PressAsync("Enter");
}
else
{
var optionLocator = page.Locator($"//div[text()='{action.Content}']"); var optionLocator = page.Locator($"//div[text()='{action.Content}']");
var optionCount = await optionLocator.CountAsync(); var optionCount = await optionLocator.CountAsync();
if (optionCount == 0) if (optionCount == 0)
@ -73,6 +80,7 @@ public partial class PlaywrightWebDriver
await optionLocator.First.ClickAsync(); await optionLocator.First.ClickAsync();
} }
} }
}
else if (action.Action == BroswerActionEnum.InputText) else if (action.Action == BroswerActionEnum.InputText)
{ {
await locator.FillAsync(action.Content); await locator.FillAsync(action.Content);