Hi,AllAnybody can tell me how to handle 'save as' window in celerity,like when we download file after click a link,a 'save as' window will be popup,how to click save button of this popup window?
Thanks-Camael
If you have a link/button/whatever to something you want to download, you
can use ClickableElement#download to get the contents as an IO object:
browser.link(:id, 'pdf').download #=> #<IO:...>
If you have a link that triggers a popup window, you can call
ClickableElement#click_and_attach, which will return a new browser instance
with the popup page loaded:
popup_browser = browser.link(:id, 'popup').click_and_attach
So if I understand your situation correctly, you want something like this:
popup_browser = browser.link(:id, 'popup').click_and_attach
io = popup_browser.button(:id, 'save').download
File.open("some_file") { |file| file.write(io.read) }
The #download method was introduced in version 0.0.6.7 of Celerity.
jb
On 22.07.09 13.53, Aslak Hellesøy <aslak.h...@gmail.com> wrote:
Please check the Watir/Celerity documentation/lists for this.
Aslak
Heh, guess I'm not helping you avoid that :)
Camael, please check out the Celerity mailing list at http://rubyforge.org/mailman/listinfo/celerity-users