Cucumber + testing JS alert

前端 未结 5 619
失恋的感觉
失恋的感觉 2021-02-04 07:05

I\'m trying to test a JS confirmation dialog with Cucumber on Rails. I have a window.onbeforeunload event handler that will prompt you with a confirmation dialog if you try to n

5条回答
  •  故里飘歌
    2021-02-04 07:25

    See the method definitions in http://selenium-client.rubyforge.org/classes/Selenium/Client/Idiomatic.html

    You can invoke them with the selenium helper object in your Cucumber step definitions -- e.g.,

    Then /^I should see a JS confirm dialog saying "([^\"]*)"$/ do |statement|    
      selenium.confirmation.should eql(statement)                               
    end
    

提交回复
热议问题