How do I confirm a javascript popup with Capybara?

前端 未结 8 975
梦谈多话
梦谈多话 2020-12-08 01:55

I\'ve tried several examples found online, but with no luck. I am looking to confirm the confirm message of a delete link. The last attempt was the code below, but that re

8条回答
  •  臣服心动
    2020-12-08 02:13

    Adding an answer for those hitting this in 2016 and beyond. You can now use Capybara directly to accept a confirmation box. You do this by wrapping the code that cause the confirmation box to appear in the accept_confirm function.

    accept_confirm do
      click_link 'Destroy'
    end
    

提交回复
热议问题