2009-06-10

How to down load file.


#!/usr/bin/env ruby

require 'test/unit'
require 'rubygems'
require 'watir'
require 'win32ole'



class FileUpLoadTest < Test::Unit::TestCase
include Watir

def test_fileup
ie = Watir::IE.new
ie.goto('foo.com/fileup.html')
assert(ie.file_field(:name,"register_data").exists?,message="error none file field")

#Start down load
ie.file_field(:id,'register_data').click_no_wait
# should click_no_wait,otherwise wait forever behind modal window.

windwName_dwn = "ファイルのダウンロード"
windwName_sve = "名前を付けて保存"
autoit=WIN32OLE.new("AutoItX3.Control")
autoit.WinWait(windwName_dwn)
autoit.WinActivate(windwName_dwn)
autoit.ControlClick(windwName_dwn,"","[CLASS:Button;INSTANCE:2]")
pathAndName = "var/foo.txt"
autoit.WinWait(windwName_sv)
autoit.WinActivate(windwName_sv)
autoit.ControlSetText(windwName_sv, "", 1148, "#{pathAndName}")
autoit.ControlClick(windwName_sv,"","[CLASS:Button;INSTANCE:2]")
autoit.WinWait("ダウンロードの完了")
end
end

0 件のコメント:

BCM4321 on Latitude D430

At kernel 3 find wireless hardware lspci | grep -i wireless  check using current kernel module with PCI bus address lspci -vv -s 0c:...