finding download box element with capybara in cucumber test

Posted by a5his on Stack Overflow See other posts from Stack Overflow or by a5his
Published on 2011-02-09T07:23:37Z Indexed on 2011/02/09 7:25 UTC
Read the original article Hit count: 205

Filed under:
|
|

Hi,

I have a link that downloads a file. As I click the link it displays dialog box with "save" and "open" option and "Cancel" and "OK" button. I want to find "OK" and "Cancel" button for cucumber test.

I took help from below link but didn't helped much.

How to test a confirm dialog with Cucumber?

**features code**

And I want to click "OK"
**steps code**

Then /^I want to click "([^\"]*)"$/ do |option|
  retval = (option == "OK") ? "true" : "false"
  page.evaluate_script('window.confirm = function() { return true; }')
  page.click("OK")
end

© Stack Overflow or respective owner

Related posts about cucumber

Related posts about bdd