0

I am getting Modal Dialog Present error while saving a form and verifying the alert popup.

Code:

Method used for verifying the text of alert pop up

def alert_text
  sleep 20
  self.button_save

  alert_element = @browser.switch_to.alert
  alert_element = alert_element.text
  alert_element.accept

  sleep 20
  print message
end
Alpha
  • 13,320
  • 27
  • 96
  • 163

1 Answers1

0

The error might be because of following line:

alert_element = alert_element.text

here alert_element is storing text and on next line you're calling method accept on alert_element which is string.

Remove following line from your code:

alert_element = alert_element.text
Alpha
  • 13,320
  • 27
  • 96
  • 163