Question

Does the page object gem support confirming two popups back to back? In other words, suppose you have a pop up that asks if you like cheese, yes or no. Given that the user chooses yes, another pop up would appear saying "you are about to answer yes," including an ok button.

Is there a way to do something like this:

@page.confirm(true) do
   @page.confirm(true) do
      button_causing_confirm_a
   end
end

Unfortunately, this did not work for me on my application. So instead, I tried handling the second pop-up with selenium-webdriver directly. Nevertheless, calling @browser.switch_to.alert throws a NoAlertPresentError saying that "No Javascript modal dialog is open". Anyone encounter anything like this?

Was it helpful?

Solution

Thanks MrTi, waiting between the switches actually worked! What a relief. The following would confirm two popups back to back:

@page.confirm(true) do
   @page.confirm(true) do
      button_causing_confirm_a
   end
   sleep 1
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top