Class: Playwright::Dialog
- Inherits:
-
PlaywrightApi
- Object
- PlaywrightApi
- Playwright::Dialog
- Defined in:
- lib/playwright_api/dialog.rb
Overview
‘Dialog` objects are dispatched by page via the [`event: Page.dialog`] event.
An example of using ‘Dialog` class:
“‘js const { chromium } = require(’playwright’); // Or ‘firefox’ or ‘webkit’.
(async () => {
const browser = await chromium.launch();
const page = await browser.newPage();
page.on('dialog', async dialog => {
console.log(dialog.());
await dialog.dismiss();
await browser.close();
});
page.evaluate(() => alert('1'));
})(); “‘
Instance Method Summary collapse
-
#accept(promptText: nil) ⇒ Object
Returns when the dialog has been accepted.
-
#default_value ⇒ Object
If dialog is prompt, returns default prompt value.
-
#dismiss ⇒ Object
Returns when the dialog has been dismissed.
-
#message ⇒ Object
A message displayed in the dialog.
-
#type_text ⇒ Object
Returns dialog’s type, can be one of ‘alert`, `beforeunload`, `confirm` or `prompt`.
Methods inherited from PlaywrightApi
Instance Method Details
#accept(promptText: nil) ⇒ Object
Returns when the dialog has been accepted.
24 25 26 |
# File 'lib/playwright_api/dialog.rb', line 24 def accept(promptText: nil) raise NotImplementedError.new('accept is not implemented yet.') end |
#default_value ⇒ Object
If dialog is prompt, returns default prompt value. Otherwise, returns empty string.
29 30 31 |
# File 'lib/playwright_api/dialog.rb', line 29 def default_value raise NotImplementedError.new('default_value is not implemented yet.') end |
#dismiss ⇒ Object
Returns when the dialog has been dismissed.
34 35 36 |
# File 'lib/playwright_api/dialog.rb', line 34 def dismiss raise NotImplementedError.new('dismiss is not implemented yet.') end |
#message ⇒ Object
A message displayed in the dialog.
39 40 41 |
# File 'lib/playwright_api/dialog.rb', line 39 def raise NotImplementedError.new('message is not implemented yet.') end |
#type_text ⇒ Object
Returns dialog’s type, can be one of ‘alert`, `beforeunload`, `confirm` or `prompt`.
44 45 46 |
# File 'lib/playwright_api/dialog.rb', line 44 def type_text raise NotImplementedError.new('type_text is not implemented yet.') end |