Module: OnlyofficeWebdriverWrapper::WebdriverAlertHelper
- Included in:
- WebDriver
- Defined in:
- lib/onlyoffice_webdriver_wrapper/webdriver/webdriver_alert_helper.rb
Overview
Methods for working with alerts
Constant Summary collapse
- NO_ALERT_EXCEPTIONS =
Exception which happens if there is no alerts
[Errno::ECONNREFUSED, Net::ReadTimeout, Selenium::WebDriver::Error::InvalidSessionIdError, Selenium::WebDriver::Error::NoSuchAlertError].freeze
Instance Method Summary collapse
-
#alert_confirm ⇒ void
Confirm current alert.
-
#alert_exists? ⇒ Boolean
Check if alert exists.
-
#alert_text ⇒ String
Get alert text.
Instance Method Details
#alert_confirm ⇒ void
This method returns an undefined value.
Confirm current alert
16 17 18 |
# File 'lib/onlyoffice_webdriver_wrapper/webdriver/webdriver_alert_helper.rb', line 16 def alert_confirm @driver.switch_to.alert.accept if alert_exists? end |
#alert_exists? ⇒ Boolean
Check if alert exists
22 23 24 25 26 27 |
# File 'lib/onlyoffice_webdriver_wrapper/webdriver/webdriver_alert_helper.rb', line 22 def alert_exists? @driver.switch_to.alert.text true rescue *NO_ALERT_EXCEPTIONS false end |
#alert_text ⇒ String
Get alert text
31 32 33 |
# File 'lib/onlyoffice_webdriver_wrapper/webdriver/webdriver_alert_helper.rb', line 31 def alert_text @driver.switch_to.alert.text end |