watir-classic 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. data/.gitignore +7 -0
  2. data/.gitmodules +3 -0
  3. data/.rspec +1 -0
  4. data/.yardopts +5 -0
  5. data/CHANGES +20 -10
  6. data/CONTRIBUTORS.txt +55 -0
  7. data/Gemfile +3 -0
  8. data/Gemfile.lock +78 -0
  9. data/README.rdoc +8 -14
  10. data/Rakefile +32 -0
  11. data/VERSION +1 -1
  12. data/lib/watir-classic.rb +0 -1
  13. data/lib/watir-classic/IEDialog/IEDialog.cpp +225 -0
  14. data/lib/watir-classic/IEDialog/IEDialog.h +15 -0
  15. data/lib/watir-classic/IEDialog/IEDialog.vcproj +159 -0
  16. data/lib/watir-classic/IEDialog/ReadMe.txt +40 -0
  17. data/lib/watir-classic/IEDialog/stdafx.cpp +8 -0
  18. data/lib/watir-classic/IEDialog/stdafx.h +21 -0
  19. data/lib/watir-classic/browser.rb +1 -1
  20. data/lib/watir-classic/container.rb +4 -33
  21. data/lib/watir-classic/core.rb +1 -3
  22. data/lib/watir-classic/dialogs/alert.rb +46 -0
  23. data/lib/watir-classic/dialogs/file_field.rb +1 -0
  24. data/lib/watir-classic/drag_and_drop_helper.rb +18 -6
  25. data/lib/watir-classic/element.rb +0 -2
  26. data/lib/watir-classic/ext/json2.js +487 -0
  27. data/lib/watir-classic/ie-class.rb +10 -164
  28. data/lib/watir-classic/ie.rb +2 -0
  29. data/lib/watir-classic/input_elements.rb +1 -1
  30. data/lib/watir-classic/modal_dialog.rb +1 -7
  31. data/lib/watir-classic/module.rb +1 -10
  32. data/lib/watir-classic/non_control_elements.rb +11 -0
  33. data/lib/watir-classic/page-container.rb +22 -24
  34. data/lib/watir-classic/screenshot.rb +33 -0
  35. data/lib/watir-classic/win32ole/1.8.7/win32ole.patch +56 -0
  36. data/lib/watir-classic/win32ole/1.9.3/win32ole.patch +63 -0
  37. data/lib/watir-classic/win32ole/build_notes.txt +18 -0
  38. data/lib/watir-classic/win32ole/history.txt +88 -0
  39. data/spec/browser_spec.rb +34 -0
  40. data/spec/implementation.rb +18 -0
  41. data/watir-classic.gemspec +40 -0
  42. data/watir.gif +0 -0
  43. metadata +159 -192
  44. data/bin/watir-console +0 -5
  45. data/lib/watir-classic/assertions.rb +0 -44
  46. data/lib/watir-classic/dialogs/javascript.rb +0 -43
  47. data/lib/watir-classic/irb-history.rb +0 -31
  48. data/lib/watir-classic/logger.rb +0 -19
  49. data/lib/watir-classic/screen_capture.rb +0 -115
  50. data/lib/watir-classic/testcase.rb +0 -97
  51. data/lib/watir-classic/waiter.rb +0 -98
  52. data/rakefile.rb +0 -54
  53. data/unittests/all_tests.rb +0 -10
  54. data/unittests/buttons_xpath_test.rb +0 -68
  55. data/unittests/checkbox_test.rb +0 -163
  56. data/unittests/checkbox_xpath_test.rb +0 -106
  57. data/unittests/click_no_wait_test.rb +0 -23
  58. data/unittests/close_all_test.rb +0 -17
  59. data/unittests/core_tests.rb +0 -17
  60. data/unittests/css_selector_test.rb +0 -44
  61. data/unittests/css_test.rb +0 -38
  62. data/unittests/dialog_test.rb +0 -64
  63. data/unittests/div2_xpath_test.rb +0 -21
  64. data/unittests/div_test.rb +0 -170
  65. data/unittests/div_xpath_test.rb +0 -95
  66. data/unittests/document_standards.rb +0 -63
  67. data/unittests/element_collection_indexes_test.rb +0 -57
  68. data/unittests/element_collections_test.rb +0 -100
  69. data/unittests/element_test.rb +0 -47
  70. data/unittests/errorchecker_test.rb +0 -31
  71. data/unittests/filefield_test.rb +0 -43
  72. data/unittests/filefield_xpath_test.rb +0 -35
  73. data/unittests/form_test.rb +0 -282
  74. data/unittests/form_xpath_test.rb +0 -254
  75. data/unittests/frame_test.rb +0 -165
  76. data/unittests/google_form_test.rb +0 -15
  77. data/unittests/html/JavascriptClick.html +0 -39
  78. data/unittests/html/blankpage.html +0 -11
  79. data/unittests/html/buttons1.html +0 -40
  80. data/unittests/html/checkboxes1.html +0 -89
  81. data/unittests/html/click_no_wait.html +0 -14
  82. data/unittests/html/complex_table.html +0 -35
  83. data/unittests/html/cssTest.html +0 -42
  84. data/unittests/html/depot_store.html +0 -59
  85. data/unittests/html/div.html +0 -92
  86. data/unittests/html/div_xml.html +0 -21
  87. data/unittests/html/fileupload.html +0 -44
  88. data/unittests/html/formTest1.html +0 -38
  89. data/unittests/html/forms2.html +0 -44
  90. data/unittests/html/forms3.html +0 -131
  91. data/unittests/html/forms4.html +0 -26
  92. data/unittests/html/frame_buttons.html +0 -4
  93. data/unittests/html/frame_links.html +0 -4
  94. data/unittests/html/frame_multi.html +0 -5
  95. data/unittests/html/google_india.html +0 -119
  96. data/unittests/html/ie7_document_standards.html +0 -9
  97. data/unittests/html/ie8_document_standards.html +0 -9
  98. data/unittests/html/ie9_document_standards.html +0 -9
  99. data/unittests/html/iframe.html +0 -3
  100. data/unittests/html/iframeTest.html +0 -17
  101. data/unittests/html/iframeTest1.html +0 -7
  102. data/unittests/html/iframeTest2.html +0 -5
  103. data/unittests/html/images/1.gif +0 -0
  104. data/unittests/html/images/2.GIF +0 -0
  105. data/unittests/html/images/3.GIF +0 -0
  106. data/unittests/html/images/button.jpg +0 -0
  107. data/unittests/html/images/circle.jpg +0 -0
  108. data/unittests/html/images/map.GIF +0 -0
  109. data/unittests/html/images/map2.gif +0 -0
  110. data/unittests/html/images/minus.GIF +0 -0
  111. data/unittests/html/images/originaltriangle.jpg +0 -0
  112. data/unittests/html/images/plus.gif +0 -0
  113. data/unittests/html/images/square.jpg +0 -0
  114. data/unittests/html/images/triangle.jpg +0 -0
  115. data/unittests/html/images1.html +0 -65
  116. data/unittests/html/javascriptevents.html +0 -33
  117. data/unittests/html/link_pass.html +0 -11
  118. data/unittests/html/links1.html +0 -37
  119. data/unittests/html/links2.html +0 -11
  120. data/unittests/html/links_multi.html +0 -12
  121. data/unittests/html/list_matters.html +0 -720
  122. data/unittests/html/lists.html +0 -18
  123. data/unittests/html/map_test.html +0 -30
  124. data/unittests/html/modal_dialog.html +0 -10
  125. data/unittests/html/modal_dialog_launcher.html +0 -12
  126. data/unittests/html/multiple_specifiers.html +0 -64
  127. data/unittests/html/nestedFrames.html +0 -6
  128. data/unittests/html/new_browser.html +0 -17
  129. data/unittests/html/pass.html +0 -13
  130. data/unittests/html/popups1.html +0 -59
  131. data/unittests/html/pre.html +0 -29
  132. data/unittests/html/quirks_document_standards.html +0 -8
  133. data/unittests/html/radioButtons1.html +0 -71
  134. data/unittests/html/select_tealeaf.html +0 -54
  135. data/unittests/html/selectboxes1.html +0 -52
  136. data/unittests/html/simple_table.html +0 -25
  137. data/unittests/html/simple_table_buttons.html +0 -104
  138. data/unittests/html/simple_table_columns.html +0 -75
  139. data/unittests/html/table1.html +0 -179
  140. data/unittests/html/tableCell_using_xpath.html +0 -19
  141. data/unittests/html/table_and_tablerow_to_a.html +0 -174
  142. data/unittests/html/textarea.html +0 -30
  143. data/unittests/html/textfields1.html +0 -100
  144. data/unittests/html/textsearch.html +0 -44
  145. data/unittests/html/wallofcheckboxes.html +0 -1003
  146. data/unittests/html/xpath_nbsp.html +0 -11
  147. data/unittests/html/zeroindex.html +0 -11
  148. data/unittests/ie_exists_test.rb +0 -16
  149. data/unittests/ie_mock.rb +0 -94
  150. data/unittests/ie_test.rb +0 -54
  151. data/unittests/images_test.rb +0 -156
  152. data/unittests/images_xpath_test.rb +0 -90
  153. data/unittests/index_specifier_test.rb +0 -31
  154. data/unittests/js_events_test.rb +0 -31
  155. data/unittests/links_multi_test.rb +0 -34
  156. data/unittests/links_test.rb +0 -131
  157. data/unittests/links_xpath_test.rb +0 -38
  158. data/unittests/lists_test.rb +0 -23
  159. data/unittests/map_test.rb +0 -98
  160. data/unittests/minmax_test.rb +0 -37
  161. data/unittests/navigate_test.rb +0 -38
  162. data/unittests/nbsp_xpath_test.rb +0 -16
  163. data/unittests/no_wait_test.rb +0 -28
  164. data/unittests/non_core_tests.rb +0 -12
  165. data/unittests/other/all_tests_concurrent.rb +0 -57
  166. data/unittests/other/navigate_exception_test.rb +0 -24
  167. data/unittests/other/rexml_unit_test.rb +0 -27
  168. data/unittests/other/screen_capture_test.rb +0 -53
  169. data/unittests/other/testcase_method_order_test.rb +0 -36
  170. data/unittests/other/testcase_verify_test.rb +0 -25
  171. data/unittests/other/wait_until_test.rb +0 -102
  172. data/unittests/pagecontainstext_test.rb +0 -69
  173. data/unittests/parent_child_test.rb +0 -27
  174. data/unittests/perf_test.rb +0 -20
  175. data/unittests/pre_test.rb +0 -49
  176. data/unittests/radios_test.rb +0 -181
  177. data/unittests/radios_xpath_test.rb +0 -100
  178. data/unittests/security_setting_test.rb +0 -24
  179. data/unittests/selectbox_test.rb +0 -144
  180. data/unittests/selectbox_xpath_test.rb +0 -102
  181. data/unittests/setup.rb +0 -69
  182. data/unittests/speed_settings_test.rb +0 -67
  183. data/unittests/table_cell_using_xpath_test.rb +0 -34
  184. data/unittests/table_test.rb +0 -296
  185. data/unittests/table_xpath_test.rb +0 -109
  186. data/unittests/test_tests.rb +0 -9
  187. data/unittests/textarea_test.rb +0 -92
  188. data/unittests/textarea_xpath_test.rb +0 -77
  189. data/unittests/textfield_for_ch_char_test.rb +0 -32
  190. data/unittests/textfields_test.rb +0 -184
  191. data/unittests/textfields_xpath_test.rb +0 -110
  192. data/unittests/version_test.rb +0 -15
  193. data/unittests/win32ole_so_test.rb +0 -35
  194. data/unittests/window_tests.rb +0 -10
  195. data/unittests/windows/attach_to_existing_window_test.rb +0 -52
  196. data/unittests/windows/attach_to_new_window_test.rb +0 -74
  197. data/unittests/windows/close_window_test.rb +0 -20
  198. data/unittests/windows/frame_links_test.rb +0 -23
  199. data/unittests/windows/ie-each_test.rb +0 -46
  200. data/unittests/windows/modal_dialog_test.rb +0 -95
  201. data/unittests/windows/new_process_test.rb +0 -24
  202. data/unittests/windows/new_test.rb +0 -58
  203. data/unittests/windows/open_close_test.rb +0 -19
  204. data/unittests/windows/send_keys_test.rb +0 -26
  205. data/unittests/xpath_tests.rb +0 -11
  206. data/watir-rdoc.rb +0 -7
@@ -0,0 +1,15 @@
1
+ extern "C" _declspec(dllexport) void ShowString(LPCTSTR dialogName);
2
+
3
+ extern "C" _declspec(dllexport) void DoElementClick(LPCTSTR windowName, LPCTSTR elementName);
4
+
5
+ extern "C" _declspec(dllexport) void DoButtonClick(LPCTSTR windowName, LPCTSTR buttonName);
6
+
7
+ extern "C" _declspec(dllexport) void GetUnknown(HWND hWindow, int* pOut);
8
+
9
+ void DoClick(LPCTSTR windowName, LPCTSTR elementId, LPCTSTR elementName);
10
+
11
+ BOOL CALLBACK EnumChildProc(HWND hwnd,LPARAM lParam);
12
+
13
+ IHTMLDocument2* GetDoc2(LPCTSTR windowName);
14
+
15
+ IHTMLElement* FindElement(IHTMLDocument2* pDoc2, LPCTSTR elementId, LPCTSTR elementName);
@@ -0,0 +1,159 @@
1
+ <?xml version="1.0" encoding="Windows-1252"?>
2
+ <VisualStudioProject
3
+ ProjectType="Visual C++"
4
+ Version="7.10"
5
+ Name="IEDialog"
6
+ ProjectGUID="{E555398C-B93E-4D77-ACA2-03EAA7F7E94A}"
7
+ RootNamespace="IEDialog"
8
+ Keyword="Win32Proj">
9
+ <Platforms>
10
+ <Platform
11
+ Name="Win32"/>
12
+ </Platforms>
13
+ <Configurations>
14
+ <Configuration
15
+ Name="Debug|Win32"
16
+ OutputDirectory="Debug"
17
+ IntermediateDirectory="Debug"
18
+ ConfigurationType="2"
19
+ CharacterSet="2">
20
+ <Tool
21
+ Name="VCCLCompilerTool"
22
+ Optimization="0"
23
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;IEDIALOG_EXPORTS"
24
+ MinimalRebuild="TRUE"
25
+ BasicRuntimeChecks="3"
26
+ RuntimeLibrary="1"
27
+ UsePrecompiledHeader="3"
28
+ WarningLevel="3"
29
+ Detect64BitPortabilityProblems="TRUE"
30
+ DebugInformationFormat="4"/>
31
+ <Tool
32
+ Name="VCCustomBuildTool"/>
33
+ <Tool
34
+ Name="VCLinkerTool"
35
+ OutputFile="$(OutDir)/IEDialog.dll"
36
+ LinkIncremental="2"
37
+ GenerateDebugInformation="TRUE"
38
+ ProgramDatabaseFile="$(OutDir)/IEDialog.pdb"
39
+ SubSystem="2"
40
+ ImportLibrary="$(OutDir)/IEDialog.lib"
41
+ TargetMachine="1"/>
42
+ <Tool
43
+ Name="VCMIDLTool"/>
44
+ <Tool
45
+ Name="VCPostBuildEventTool"/>
46
+ <Tool
47
+ Name="VCPreBuildEventTool"/>
48
+ <Tool
49
+ Name="VCPreLinkEventTool"/>
50
+ <Tool
51
+ Name="VCResourceCompilerTool"/>
52
+ <Tool
53
+ Name="VCWebServiceProxyGeneratorTool"/>
54
+ <Tool
55
+ Name="VCXMLDataGeneratorTool"/>
56
+ <Tool
57
+ Name="VCWebDeploymentTool"/>
58
+ <Tool
59
+ Name="VCManagedWrapperGeneratorTool"/>
60
+ <Tool
61
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
62
+ </Configuration>
63
+ <Configuration
64
+ Name="Release|Win32"
65
+ OutputDirectory="Release"
66
+ IntermediateDirectory="Release"
67
+ ConfigurationType="2"
68
+ CharacterSet="2">
69
+ <Tool
70
+ Name="VCCLCompilerTool"
71
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;IEDIALOG_EXPORTS"
72
+ RuntimeLibrary="0"
73
+ UsePrecompiledHeader="3"
74
+ WarningLevel="3"
75
+ Detect64BitPortabilityProblems="TRUE"
76
+ DebugInformationFormat="3"/>
77
+ <Tool
78
+ Name="VCCustomBuildTool"/>
79
+ <Tool
80
+ Name="VCLinkerTool"
81
+ OutputFile="$(OutDir)/IEDialog.dll"
82
+ LinkIncremental="1"
83
+ GenerateDebugInformation="TRUE"
84
+ SubSystem="2"
85
+ OptimizeReferences="2"
86
+ EnableCOMDATFolding="2"
87
+ ImportLibrary="$(OutDir)/IEDialog.lib"
88
+ TargetMachine="1"/>
89
+ <Tool
90
+ Name="VCMIDLTool"/>
91
+ <Tool
92
+ Name="VCPostBuildEventTool"/>
93
+ <Tool
94
+ Name="VCPreBuildEventTool"/>
95
+ <Tool
96
+ Name="VCPreLinkEventTool"/>
97
+ <Tool
98
+ Name="VCResourceCompilerTool"/>
99
+ <Tool
100
+ Name="VCWebServiceProxyGeneratorTool"/>
101
+ <Tool
102
+ Name="VCXMLDataGeneratorTool"/>
103
+ <Tool
104
+ Name="VCWebDeploymentTool"/>
105
+ <Tool
106
+ Name="VCManagedWrapperGeneratorTool"/>
107
+ <Tool
108
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
109
+ </Configuration>
110
+ </Configurations>
111
+ <References>
112
+ </References>
113
+ <Files>
114
+ <Filter
115
+ Name="Source Files"
116
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
117
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
118
+ <File
119
+ RelativePath=".\IEDialog.cpp">
120
+ </File>
121
+ <File
122
+ RelativePath=".\stdafx.cpp">
123
+ <FileConfiguration
124
+ Name="Debug|Win32">
125
+ <Tool
126
+ Name="VCCLCompilerTool"
127
+ UsePrecompiledHeader="1"/>
128
+ </FileConfiguration>
129
+ <FileConfiguration
130
+ Name="Release|Win32">
131
+ <Tool
132
+ Name="VCCLCompilerTool"
133
+ UsePrecompiledHeader="1"/>
134
+ </FileConfiguration>
135
+ </File>
136
+ </Filter>
137
+ <Filter
138
+ Name="Header Files"
139
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
140
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
141
+ <File
142
+ RelativePath=".\IEDialog.h">
143
+ </File>
144
+ <File
145
+ RelativePath=".\stdafx.h">
146
+ </File>
147
+ </Filter>
148
+ <Filter
149
+ Name="Resource Files"
150
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
151
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
152
+ </Filter>
153
+ <File
154
+ RelativePath=".\ReadMe.txt">
155
+ </File>
156
+ </Files>
157
+ <Globals>
158
+ </Globals>
159
+ </VisualStudioProject>
@@ -0,0 +1,40 @@
1
+ ========================================================================
2
+ DYNAMIC LINK LIBRARY : IEDialog Project Overview
3
+ ========================================================================
4
+
5
+ AppWizard has created this IEDialog DLL for you.
6
+ This file contains a summary of what you will find in each of the files that
7
+ make up your IEDialog application.
8
+
9
+
10
+ IEDialog.vcproj
11
+ This is the main project file for VC++ projects generated using an Application Wizard.
12
+ It contains information about the version of Visual C++ that generated the file, and
13
+ information about the platforms, configurations, and project features selected with the
14
+ Application Wizard.
15
+
16
+ IEDialog.cpp
17
+ This is the main DLL source file.
18
+
19
+ When created, this DLL does not export any symbols. As a result, it
20
+ will not produce a .lib file when it is built. If you wish this project
21
+ to be a project dependency of some other project, you will either need to
22
+ add code to export some symbols from the DLL so that an export library
23
+ will be produced, or you can set the Ignore Input Library property to Yes
24
+ on the General propert page of the Linker folder in the project's Property
25
+ Pages dialog box.
26
+
27
+ /////////////////////////////////////////////////////////////////////////////
28
+ Other standard files:
29
+
30
+ StdAfx.h, StdAfx.cpp
31
+ These files are used to build a precompiled header (PCH) file
32
+ named IEDialog.pch and a precompiled types file named StdAfx.obj.
33
+
34
+ /////////////////////////////////////////////////////////////////////////////
35
+ Other notes:
36
+
37
+ AppWizard uses "TODO:" comments to indicate parts of the source code you
38
+ should add to or customize.
39
+
40
+ /////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,8 @@
1
+ // stdafx.cpp : source file that includes just the standard includes
2
+ // IEDialog.pch will be the pre-compiled header
3
+ // stdafx.obj will contain the pre-compiled type information
4
+
5
+ #include "stdafx.h"
6
+
7
+ // TODO: reference any additional headers you need in STDAFX.H
8
+ // and not in this file
@@ -0,0 +1,21 @@
1
+ // stdafx.h : include file for standard system include files,
2
+ // or project specific include files that are used frequently, but
3
+ // are changed infrequently
4
+ //
5
+
6
+ #pragma once
7
+
8
+
9
+ #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
10
+ // Windows Header Files:
11
+ #include <windows.h>
12
+ #include <mshtml.h>
13
+ #include <oleacc.h>
14
+ #include <atlbase.h>
15
+ #include <atlcom.h>
16
+ #include <atlwin.h>
17
+ #include <atltypes.h>
18
+ #include <atlctl.h>
19
+ #include <atlhost.h>
20
+
21
+ // TODO: reference additional headers your program requires here
@@ -60,7 +60,7 @@ before you invoke Browser.new.
60
60
  # Create a new instance of a browser driver, as determined by the
61
61
  # configuration settings. (Don't be fooled: this is not actually
62
62
  # an instance of Browser class.)
63
- def new
63
+ def new ignored=nil # argument is needed to make watir-classic more compatible with watir-webdriver
64
64
  set_sub_options
65
65
  klass.new
66
66
  end
@@ -38,11 +38,6 @@ module Watir
38
38
  end
39
39
  private :copy_test_config
40
40
 
41
- # Write the specified string to the log.
42
- def log(what)
43
- @container.logger.debug(what) if @logger
44
- end
45
-
46
41
  # Wait until Browser has finished loading the page.
47
42
  #--
48
43
  # called explicitly by most click and set methods
@@ -61,6 +56,10 @@ module Watir
61
56
  ModalDialog.new(self)
62
57
  end
63
58
 
59
+ def alert
60
+ Alert.new(self)
61
+ end
62
+
64
63
  # Searching for Page Elements
65
64
  # Not for external consumption
66
65
  #
@@ -69,34 +68,6 @@ module Watir
69
68
  return document.body.all
70
69
  end
71
70
 
72
- # This method shows the available objects on the current page.
73
- # This is usually only used for debugging or writing new test scripts.
74
- # This is a nice feature to help find out what HTML objects are on a page
75
- # when developing a test case using Watir.
76
- def show_all_objects
77
- puts "-----------Objects in page -------------"
78
- doc = document
79
- s = ""
80
- props = ["name", "id", "value", "alt", "src"]
81
- doc.all.each do |n|
82
- begin
83
- s += n.invoke("type").to_s.ljust(16)
84
- rescue
85
- next
86
- end
87
- props.each do |prop|
88
- begin
89
- p = n.invoke(prop)
90
- s += " " + "#{prop}=#{p}".to_s.ljust(18)
91
- rescue
92
- # this object probably doesnt have this property
93
- end
94
- end
95
- s += "\n"
96
- end
97
- puts s
98
- end
99
-
100
71
  # Locator Methods
101
72
  #
102
73
  # Not for external use, but cannot set to private due to usages in Element
@@ -11,8 +11,6 @@ require 'watir-classic/wait'
11
11
  require 'watir-classic/wait_helper'
12
12
  require 'watir-classic/element_extensions'
13
13
 
14
- require 'logger'
15
- require 'watir-classic/logger'
16
14
  require 'watir-classic/container'
17
15
  require 'watir-classic/xpath_locator'
18
16
  require 'watir-classic/locator'
@@ -38,6 +36,6 @@ require 'watir-classic/module'
38
36
 
39
37
  require 'rautomation'
40
38
  require 'watir-classic/dialogs/file_field'
41
- require 'watir-classic/dialogs/javascript'
39
+ require 'watir-classic/dialogs/alert'
42
40
 
43
41
  require 'watir-classic/supported_elements'
@@ -0,0 +1,46 @@
1
+ module Watir
2
+ class Alert
3
+ include ElementExtensions
4
+
5
+ WINDOW_TITLES = ['Message from webpage', 'Windows Internet Explorer', 'Microsoft Internet Explorer', /Mensaje de p.*/, "Explorer User Prompt"]
6
+
7
+ def initialize(container)
8
+ @container = container
9
+ end
10
+
11
+ def exists?
12
+ dialog.present?
13
+ end
14
+
15
+ alias_method :present?, :exists?
16
+
17
+ def close
18
+ dialog.close
19
+ wait_until_not_exists
20
+ end
21
+
22
+ def text
23
+ dialog.text
24
+ end
25
+
26
+ def ok
27
+ dialog.button(:value => "OK").click
28
+ wait_until_not_exists
29
+ end
30
+
31
+ def set(text)
32
+ dialog.text_field.set text
33
+ end
34
+
35
+ private
36
+
37
+ def dialog
38
+ @window ||= RAutomation::Window.new(:hwnd => @container.hwnd).child(:title => /^(#{WINDOW_TITLES.join('|')})$/)
39
+ end
40
+
41
+ def wait_until_not_exists
42
+ Wait.until(3) {!exists?}
43
+ @container.page_container.wait
44
+ end
45
+ end
46
+ end
@@ -6,6 +6,7 @@ module Watir
6
6
  click_no_wait
7
7
  set_file_name file_path.gsub(File::SEPARATOR, File::ALT_SEPARATOR)
8
8
  open_button.click
9
+ Wait.until(5) {value.include?(File.basename(file_path))}
9
10
  end
10
11
 
11
12
  alias_method :value=, :set
@@ -4,26 +4,34 @@ module Watir
4
4
  def drag_and_drop_on(target)
5
5
  perform_action do
6
6
  assert_target target
7
- drop_x, drop_y = target.send :source_x_y
8
- drag_to drop_x, drop_y
7
+ drag_to do |mouse|
8
+ ole_object.document.parentWindow.scrollTo(*target.send(:source_x_y_relative))
9
+ drop_x, drop_y = target.send(:source_x_y)
10
+ mouse.move :x => drop_x, :y => drop_y
11
+ end
9
12
  end
10
13
  end
11
14
 
12
15
  def drag_and_drop_by(distance_x, distance_y)
13
16
  perform_action do
14
- drag_x, drag_y = source_x_y
15
- drag_to drag_x + distance_x, drag_y + distance_y
17
+ drag_to do |mouse|
18
+ drag_x, drag_y = source_x_y
19
+ ole_object.document.parentWindow.scrollTo(drag_x + distance_x, drag_y + distance_y)
20
+ drag_x, drag_y = source_x_y
21
+ mouse.move :x => drag_x + distance_x, :y => drag_y + distance_y
22
+ end
16
23
  end
17
24
  end
18
25
 
19
26
  private
20
27
 
21
- def drag_to(drop_x, drop_y)
28
+ def drag_to
29
+ ole_object.document.parentWindow.scrollTo(*source_x_y_relative)
22
30
  drag_x, drag_y = source_x_y
23
31
  mouse = page_container.rautomation.mouse
24
32
  mouse.move :x => drag_x , :y => drag_y
25
33
  mouse.press
26
- mouse.move :x => drop_x, :y => drop_y
34
+ yield mouse
27
35
  mouse.release
28
36
  end
29
37
 
@@ -31,6 +39,10 @@ module Watir
31
39
  center_x_y_absolute left_edge_absolute, top_edge_absolute
32
40
  end
33
41
 
42
+ def source_x_y_relative
43
+ center_x_y_absolute left_edge, top_edge
44
+ end
45
+
34
46
  def assert_target(target)
35
47
  target.assert_exists
36
48
  target.assert_enabled
@@ -296,8 +296,6 @@ module Watir
296
296
  end
297
297
 
298
298
  def dispatch_event(event)
299
- assert_exists
300
-
301
299
  if IE.version_parts.first.to_i >= 9 && container.page_container.document.documentMode.to_i >= 9
302
300
  ole_object.dispatchEvent(create_event(event))
303
301
  else