Class: Playwright::Dialog

Inherits:
PlaywrightApi show all
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.message());
  await dialog.dismiss();
  await browser.close();
});
page.evaluate(() => alert('1'));

})(); “‘

Instance Method Summary collapse

Methods inherited from PlaywrightApi

from_channel_owner

Instance Method Details

#accept(promptText: nil) ⇒ Object

Returns when the dialog has been accepted.

Raises:

  • (NotImplementedError)


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_valueObject

If dialog is prompt, returns default prompt value. Otherwise, returns empty string.

Raises:

  • (NotImplementedError)


29
30
31
# File 'lib/playwright_api/dialog.rb', line 29

def default_value
  raise NotImplementedError.new('default_value is not implemented yet.')
end

#dismissObject

Returns when the dialog has been dismissed.

Raises:

  • (NotImplementedError)


34
35
36
# File 'lib/playwright_api/dialog.rb', line 34

def dismiss
  raise NotImplementedError.new('dismiss is not implemented yet.')
end

#messageObject

A message displayed in the dialog.

Raises:

  • (NotImplementedError)


39
40
41
# File 'lib/playwright_api/dialog.rb', line 39

def message
  raise NotImplementedError.new('message is not implemented yet.')
end

#type_textObject

Returns dialog’s type, can be one of ‘alert`, `beforeunload`, `confirm` or `prompt`.

Raises:

  • (NotImplementedError)


44
45
46
# File 'lib/playwright_api/dialog.rb', line 44

def type_text
  raise NotImplementedError.new('type_text is not implemented yet.')
end