开发者

How do I use Watir to download a file to a specific location in IE9

开发者 https://www.devze.com 2023-03-17 05:51 出处:网络
In the older versions of IE, there is a popup window. In IE9 it\'s a开发者_高级运维 funny looking bar on the bottom.

In the older versions of IE, there is a popup window. In IE9 it's a开发者_高级运维 funny looking bar on the bottom. Anybody had tried anything that works yet?


The only way for now is sending TABs.

For example with Watir and RAutomation

ww = Watir::IE.attach(:url, /1.1.1.127/)

#Click on download link
ww.link(:text, /Download_link/).click

#Click on 'Save As' in the 'funny looking bar on the bottom'
wrauto = RAutomation::Window.new(:title => ww.title)
wrauto.send_keys("{TAB}")
wrauto.send_keys("{TAB}")
wrauto.send_keys("{DOWN}")
wrauto.send_keys("{DOWN}")
wrauto.send_keys("{ENTER}")

#popup window to save
w = RAutomation::Window.new(:title => /Save As/)

#Direction that you going to save
w.text_field(:class => "Edit", :index => 0).set path_direction

w.button(:value => "&Save").click
RAutomation::Window.new(:title => /complete/).button(:value => "Close").click
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号