Reputation: 6568
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
Upvotes: 2
Views: 562
Reputation: 31
The issue is that the dialogue you are talking about is not actually a part of the webpage at all. its part of the browser. Really, that part of the user interface it outside the control of the webpage.
All you can test is the webpage UP to the point of requesting the download, what the browser does with that request subsequently is not something you can script with cuke.
Sorry.
Upvotes: 1