I don't like the way Page Object uses blocks... In Watir it is simply: alert_text = @browser.alert.text @browser.alert.dismiss
On Wed, Apr 10, 2019 at 9:23 PM NaviHan <[email protected]> wrote: > > Im trying to capture the alert text and dismiss the alert using the "alert" > method > > def test > @browser.div(:class => 'address-details', :index =>0).click > alert_text = alert do > @browser.div(:class => 'select-checkbox', :index =>1).click > end > sleep 10 > puts alert_text > > > end > > > I have passed @browser.div(:class => 'select-checkbox', :index =>1).click > into the alert method which actually triggers the alert > > As per the implementation this should capture the alert text and click OK > > However I'm getting this error > > elenium::WebDriver::Error::UnhandledAlertError: unexpected alert open: {Alert > text : This address cannot be used.} > (Session info: chrome=73.0.3683.86) > (Driver info: chromedriver=2.38.552522 > (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Windows NT 10.0.17134 > x86_64) > > > A video of the issue here @ > https://drive.google.com/file/d/1Di9idgfqjE7TLSn5QG7pgUFxpln3kben/view?usp=sharing > > -- > -- > Before posting, please read > https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group. > In short: search before you ask, be nice. > > [email protected] > http://groups.google.com/group/watir-general > [email protected] > --- > You received this message because you are subscribed to the Google Groups > "Watir General" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- -- Before posting, please read https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected] --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
