我正在尝试填写在线帐户创建表格。但是有一个下拉选项不是正常的选择元素。如果它对 c# 来说很简单,请帮助抱歉。
public static async Task Main()
{
using var playwright = await Playwright.CreateAsync();
var chromium = playwright.Chromium;
var browser = await chromium.LaunchAsync(new BrowserTypeLaunchOptions {Headless = false});
Console.WriteLine(browser.IsConnected);
var page = await browser.NewPageAsync();
await page.GotoAsync("https://www.slamjam.com/en_SG/login?action=register");
await page.SelectOptionAsync("xpath=/html/body/div[1]/main/div/div/div/div/form/div[1]/span/span[1]/span", new SelectOptionValue { Label = "Mr." });
await page.FillAsync("id=registration-form-fname", "belinda");
await page.FillAsync("id=registration-form-lname", "Yeo");
await page.FillAsync("id=registration-form-birthday", "17/12/1990");
await page.FillAsync("id=registration-form-email", "email");
await page.FillAsync("id=registration-form-email-confirm", "email");
await page.FillAsync("id=registration-form-password", "PW");
await page.FillAsync("id=registration-form-password-confirm", "PW");
await page.CheckAsync("xpath=/ html / body / div[1] / main / div / div / div / div / form / div[9] / label");
await page.CheckAsync("xpath=/html/body/div[1]/main/div/div/div/div/form/div[11]/label");
await page.ClickAsync("id=validationCaptchaRegistration");
}
如果您看到我尝试使用 Playwright 中的选择选项功能,但无济于事。