메인 컨텐츠로 건너뛰기

type

Returns dialog's type, can be one of alert, beforeunload, confirm or prompt.

정보

Only works with browser dialogs (via BiDi protocol). Native mobile dialogs do not expose a dialog type through WebDriver. Use browser.acceptDialog or browser.dismissDialog to handle them.

Usage​

await dialog.type()

Example​

dialogType.js
// Listen for the dialog event to get the dialog object
browser.on('dialog', async (dialog) => {
const type = await dialog.type();
console.log(type); // prints: 'alert', 'confirm', 'prompt', or 'beforeunload'
});

Returns​

  • <string> returns: The type of the dialog

Welcome! How can I help?

WebdriverIO AI Copilot