windown confirm dialog #2517
Unanswered
JasonCSharpCoder
asked this question in
Q&A
Replies: 1 comment
-
You should attach to the Dialog event before performing the actions. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Dear guys
I have page like below, I click one button by puppeeter page , then the btn script open window confirm dialog,
I want to know how to accept the dialog?
await page.GoToAsync("http://localhost/a.html");
await page.WaitForExpressionAsync("window.location=='http://localhost/a.html'");
await page.ClickAsync("#btn");
//await page.Keyboard.DownAsync("Enter");
//await page.Keyboard.UpAsync("Enter");
//await page.Keyboard.PressAsync("Enter");
///no trigger for below code
page.Dialog += async (_, dialog) =>
{
if (dialog.Dialog.DialogType == DialogType.Confirm)
{
// 模拟点击确认按钮
await dialog.Dialog.Accept();
}
else
{
};
Beta Was this translation helpful? Give feedback.
All reactions