Sha256: ac6804042c3717fad72808ea318f0cf8e407053ece0da37d9f2f4100af89d06b
Contents?: true
Size: 1.87 KB
Versions: 2
Compression:
Stored size: 1.87 KB
Contents
# unit tests for iedialog.dll and customized win32ole.so # revision: $Revision: 1278 $ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..') if $0 == __FILE__ require 'unittests/setup' require 'Win32API' if VERSION == '1.8.2' class TC_IEDialog < Test::Unit::TestCase include Watir # this will find the IEDialog.dll file in its build location @@iedialog_file = (File.expand_path(File.dirname(__FILE__)) + "/../../watir/IEDialog/Release/IEDialog.dll").gsub('/', '\\') # commented out because it currently requires a manual click # a better idea would be to automate the click... def xtest_connect_to_iedialog # make sure we can connect to the IEDialog.dll fnShowString = Win32API.new(@@iedialog_file, 'ShowString', ['p'], 'v') fnShowString.call("from ruby!") # blocks end def test_find_window $ie.goto($htmlRoot + "pass.html") fnFindWindow = Win32API.new('user32.dll', 'FindWindow', ['p', 'p'], 'l') hwnd = fnFindWindow.call(nil, "Pass Page - Microsoft Internet Explorer") assert(hwnd != 0) end def test_all $ie.goto($htmlRoot + "pass.html") fnFindWindow = Win32API.new('user32.dll', 'FindWindow', ['p', 'p'], 'l') hwnd = fnFindWindow.call(nil, "Pass Page - Microsoft Internet Explorer") fnGetUnknown = Win32API.new(@@iedialog_file, 'GetUnknown', ['l', 'p'], 'v') intPointer = " " * 4 # will contain the int value of the IUnknown* fnGetUnknown.call(hwnd, intPointer) intArray = intPointer.unpack('L') intUnknown = intArray.first assert(intUnknown > 0) htmlDoc = nil assert_nothing_raised{htmlDoc = WIN32OLE.connect_unknown(intUnknown)} scriptEngine = htmlDoc.Script # now we get the HTML DOM object! doc2 = scriptEngine.document body = doc2.body assert_match(/^PASS/, body.innerHTML.strip) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
watir-1.5.3 | unittests/windows/iedialog_test.rb |
watir-1.5.4 | unittests/windows/iedialog_test.rb |