Search code examples
filedownloadcucumberconfirmation

cucumber file download confirm


I have a cucumber step where the file gets downloaded, but i am unable to click the save button in the dialog box that a browser provides, with cucumber step.

I have found some pages which solves the similar kind of problems, but it didn't solve mine

How to test a confirm dialog with Cucumber?

I have included this cucumber step for file download

When /^I confirm a js popup on the next step$/ do
  page.evaluate_script("window.alert = function(msg) { return true; }")
  page.evaluate_script("window.confirm = function(msg) { return true; }")
end

But didn't work.

Thanks


Solution

  • Did you try the page.driver syntax?

    i.e., from: How to test a confirm dialog with Cuccumber?:

    When /^I confirm popup$/ do
      page.driver.browser.switch_to.alert.accept    
    end
    
    When /^I dismiss popup$/ do
     page.driver.browser.switch_to.alert.dismiss
    end
    

    ian.