watir-webdriver 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,6 +8,7 @@ module Watir
8
8
  end
9
9
 
10
10
  load :fireEvent
11
+ load :getAttribute
11
12
  load :getOuterHtml
12
13
  load :getParentElement
13
14
 
@@ -0,0 +1,18 @@
1
+ // Copyright 2011 Software Freedom Conservatory
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+
14
+ function(){return function(){var d=null,e=this;function f(b,a){function c(){}c.prototype=a.prototype;b.g=a.prototype;b.prototype=new c};function g(b){for(var a=1;a<arguments.length;a++)var c=String(arguments[a]).replace(/\$/g,"$$$$"),b=b.replace(/\%s/,c);return b}function i(b){return b.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")}function j(b,a){if(b<a)return-1;else if(b>a)return 1;return 0};var k,l,m,p;function q(){return e.navigator?e.navigator.userAgent:d}p=m=l=k=!1;var r;if(r=q()){var s=e.navigator;k=r.indexOf("Opera")==0;l=!k&&r.indexOf("MSIE")!=-1;m=!k&&r.indexOf("WebKit")!=-1;p=!k&&!m&&s.product=="Gecko"}var t=l,u=p,x=m,y;
15
+ a:{var z="",A;if(k&&e.opera)var B=e.opera.version,z=typeof B=="function"?B():B;else if(u?A=/rv\:([^\);]+)(\)|;)/:t?A=/MSIE\s+([^\);]+)(\)|;)/:x&&(A=/WebKit\/(\S+)/),A)var C=A.exec(q()),z=C?C[1]:"";if(t){var D,E=e.document;D=E?E.documentMode:void 0;if(D>parseFloat(z)){y=String(D);break a}}y=z}var F={};
16
+ function G(b){var a;if(!(a=F[b])){a=0;for(var c=i(String(y)).split("."),h=i(String(b)).split("."),v=Math.max(c.length,h.length),w=0;a==0&&w<v;w++){var U=c[w]||"",V=h[w]||"",W=RegExp("(\\d*)(\\D*)","g"),X=RegExp("(\\d*)(\\D*)","g");do{var n=W.exec(U)||["","",""],o=X.exec(V)||["","",""];if(n[0].length==0&&o[0].length==0)break;a=j(n[1].length==0?0:parseInt(n[1],10),o[1].length==0?0:parseInt(o[1],10))||j(n[2].length==0,o[2].length==0)||j(n[2],o[2])}while(a==0)}a=F[b]=a>=0}return a};function H(b){this.stack=Error().stack||"";if(b)this.message=String(b)}f(H,Error);H.prototype.name="CustomError";function I(b,a){H.call(this,a);this.code=b;this.name=J[b]||J[13]}f(I,H);
17
+ var J,K={NoSuchElementError:7,NoSuchFrameError:8,UnknownCommandError:9,StaleElementReferenceError:10,ElementNotVisibleError:11,InvalidElementStateError:12,UnknownError:13,ElementNotSelectableError:15,XPathLookupError:19,NoSuchWindowError:23,InvalidCookieDomainError:24,UnableToSetCookieError:25,ModalDialogOpenedError:26,NoModalDialogOpenError:27,ScriptTimeoutError:28,InvalidSelectorError:32,SqlDatabaseError:33,MoveTargetOutOfBoundsError:34},L={},M;for(M in K)L[K[M]]=M;J=L;
18
+ I.prototype.toString=function(){return"["+this.name+"] "+this.message};function N(b,a){a.unshift(b);H.call(this,g.apply(d,a));a.shift();this.f=b}f(N,H);N.prototype.name="AssertionError";function O(b){var a=P;if(typeof a=="string"){if(typeof b!="string"||b.length!=1)return-1;return a.indexOf(b,0)}for(var c=0;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1};!t||G("9");!u&&!t||t&&G("9")||u&&G("1.9.1");t&&G("9");function Q(b,a,c,h,v){this.b=!!a;if(b&&(this.a=b))this.c=typeof h=="number"?h:this.a.nodeType!=1?0:this.b?-1:1;this.d=v!=void 0?v:this.c||0;this.b&&(this.d*=-1);this.e=!c}f(Q,function(){});Q.prototype.a=d;Q.prototype.c=0;f(function(b,a,c,h){Q.call(this,b,a,c,d,h)},Q);var P=["async","autofocus","autoplay","checked","compact","complete","controls","declare","defaultchecked","defaultselected","defer","disabled","draggable","ended","formnovalidate","hidden","indeterminate","iscontenteditable","ismap","itemscope","loop","multiple","muted","nohref","noresize","noshade","novalidate","nowrap","open","paused","pubdate","readonly","required","reversed","scoped","seamless","seeking","selected","spellcheck","truespeed","willvalidate"];function R(b,a){if(8==b.nodeType)return d;a=a.toLowerCase();if(a=="style"){var c=i(b.style.cssText).toLowerCase();return c.charAt(c.length-1)==";"?c:c+";"}c=b.getAttributeNode(a);t&&!c&&G(8)&&O(a)>=0&&(c=b[a]);if(!c)return d;if(O(a)>=0)return t&&c.value=="false"?d:"true";return c.specified?c.value:d}var S="_".split("."),T=e;!(S[0]in T)&&T.execScript&&T.execScript("var "+S[0]);for(var Y;S.length&&(Y=S.shift());)!S.length&&R!==void 0?T[Y]=R:T=T[Y]?T[Y]:T[Y]={};; return this._.apply(null,arguments);}.apply({navigator:typeof window!='undefined'?window.navigator:null}, arguments);}
@@ -275,7 +275,7 @@ module Watir
275
275
 
276
276
  def attribute?(attribute)
277
277
  assert_exists
278
- driver.execute_script "return !!arguments[0].getAttributeNode(arguments[1]);", @element, attribute.to_s.downcase
278
+ !!execute_atom(:getAttribute, @element, attribute.to_s.downcase)
279
279
  end
280
280
 
281
281
  def assert_enabled
@@ -1,3 +1,3 @@
1
1
  module Watir
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
data/spec/element_spec.rb CHANGED
@@ -2,49 +2,6 @@ require File.expand_path('watirspec/spec_helper', File.dirname(__FILE__))
2
2
 
3
3
  describe Watir::Element do
4
4
 
5
- describe '#send_keys' do
6
- before(:each) do
7
- @c = Selenium::WebDriver::Platform.os == :macosx ? :command : :control
8
- browser.goto('file://' + File.expand_path('html/keylogger.html', File.dirname(__FILE__)))
9
- end
10
-
11
- let(:receiver) { browser.element(:id => 'receiver') }
12
- let(:events) { browser.element(:id => 'output').ps.size }
13
-
14
- it 'sends keystrokes to the element' do
15
- receiver.send_keys 'hello world'
16
- receiver.value.should == 'hello world'
17
- events.should == 11
18
- end
19
-
20
- it 'accepts arbitrary list of arguments' do
21
- receiver.send_keys 'hello', 'world'
22
- receiver.value.should == 'helloworld'
23
- events.should == 10
24
- end
25
-
26
- it 'performs key combinations' do
27
- receiver.send_keys 'foo'
28
- receiver.send_keys [@c, 'a']
29
- receiver.send_keys :backspace
30
- receiver.value.should be_empty
31
- events.should == 6
32
- end
33
-
34
- it 'performs arbitrary list of key combinations' do
35
- receiver.send_keys 'foo'
36
- receiver.send_keys [@c, 'a'], [@c, 'x']
37
- receiver.value.should be_empty
38
- events.should == 7
39
- end
40
-
41
- it 'supports combination of strings and arrays' do
42
- receiver.send_keys 'foo', [@c, 'a'], :backspace
43
- receiver.value.should be_empty
44
- events.should == 6
45
- end
46
- end
47
-
48
5
  describe '#present?' do
49
6
  before do
50
7
  browser.goto('file://' + File.expand_path('html/wait.html', File.dirname(__FILE__)))
metadata CHANGED
@@ -1,187 +1,133 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: watir-webdriver
3
- version: !ruby/object:Gem::Version
4
- hash: 21
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.4
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 3
9
- - 3
10
- version: 0.3.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Jari Bakken
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-09-08 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2011-09-23 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: selenium-webdriver
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &2166058680 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 19
29
- segments:
30
- - 0
31
- - 2
32
- - 2
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
33
21
  version: 0.2.2
34
22
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: rspec
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *2166058680
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &2166057780 !ruby/object:Gem::Requirement
40
28
  none: false
41
- requirements:
29
+ requirements:
42
30
  - - ~>
43
- - !ruby/object:Gem::Version
44
- hash: 3
45
- segments:
46
- - 2
47
- - 3
48
- - 0
31
+ - !ruby/object:Gem::Version
49
32
  version: 2.3.0
50
33
  type: :development
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: yard
54
34
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *2166057780
36
+ - !ruby/object:Gem::Dependency
37
+ name: yard
38
+ requirement: &2166057120 !ruby/object:Gem::Requirement
56
39
  none: false
57
- requirements:
40
+ requirements:
58
41
  - - ~>
59
- - !ruby/object:Gem::Version
60
- hash: 7
61
- segments:
62
- - 0
63
- - 6
64
- version: "0.6"
42
+ - !ruby/object:Gem::Version
43
+ version: '0.6'
65
44
  type: :development
66
- version_requirements: *id003
67
- - !ruby/object:Gem::Dependency
68
- name: webidl
69
45
  prerelease: false
70
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *2166057120
47
+ - !ruby/object:Gem::Dependency
48
+ name: webidl
49
+ requirement: &2166056540 !ruby/object:Gem::Requirement
71
50
  none: false
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- hash: 25
76
- segments:
77
- - 0
78
- - 1
79
- - 1
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
80
54
  version: 0.1.1
81
55
  type: :development
82
- version_requirements: *id004
83
- - !ruby/object:Gem::Dependency
84
- name: sinatra
85
56
  prerelease: false
86
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *2166056540
58
+ - !ruby/object:Gem::Dependency
59
+ name: sinatra
60
+ requirement: &2166055760 !ruby/object:Gem::Requirement
87
61
  none: false
88
- requirements:
62
+ requirements:
89
63
  - - ~>
90
- - !ruby/object:Gem::Version
91
- hash: 15
92
- segments:
93
- - 1
94
- - 0
95
- version: "1.0"
64
+ - !ruby/object:Gem::Version
65
+ version: '1.0'
96
66
  type: :development
97
- version_requirements: *id005
98
- - !ruby/object:Gem::Dependency
99
- name: headless
100
67
  prerelease: false
101
- requirement: &id006 !ruby/object:Gem::Requirement
68
+ version_requirements: *2166055760
69
+ - !ruby/object:Gem::Dependency
70
+ name: headless
71
+ requirement: &2166054120 !ruby/object:Gem::Requirement
102
72
  none: false
103
- requirements:
73
+ requirements:
104
74
  - - ~>
105
- - !ruby/object:Gem::Version
106
- hash: 15
107
- segments:
108
- - 0
109
- - 2
110
- version: "0.2"
75
+ - !ruby/object:Gem::Version
76
+ version: '0.2'
111
77
  type: :development
112
- version_requirements: *id006
113
- - !ruby/object:Gem::Dependency
114
- name: rake
115
78
  prerelease: false
116
- requirement: &id007 !ruby/object:Gem::Requirement
79
+ version_requirements: *2166054120
80
+ - !ruby/object:Gem::Dependency
81
+ name: rake
82
+ requirement: &2166052140 !ruby/object:Gem::Requirement
117
83
  none: false
118
- requirements:
84
+ requirements:
119
85
  - - ~>
120
- - !ruby/object:Gem::Version
121
- hash: 63
122
- segments:
123
- - 0
124
- - 9
125
- - 2
86
+ - !ruby/object:Gem::Version
126
87
  version: 0.9.2
127
88
  type: :development
128
- version_requirements: *id007
129
- - !ruby/object:Gem::Dependency
130
- name: fuubar
131
89
  prerelease: false
132
- requirement: &id008 !ruby/object:Gem::Requirement
90
+ version_requirements: *2166052140
91
+ - !ruby/object:Gem::Dependency
92
+ name: fuubar
93
+ requirement: &2166051540 !ruby/object:Gem::Requirement
133
94
  none: false
134
- requirements:
95
+ requirements:
135
96
  - - ~>
136
- - !ruby/object:Gem::Version
137
- hash: 19
138
- segments:
139
- - 0
140
- - 0
141
- - 6
97
+ - !ruby/object:Gem::Version
142
98
  version: 0.0.6
143
99
  type: :development
144
- version_requirements: *id008
145
- - !ruby/object:Gem::Dependency
146
- name: nokogiri
147
100
  prerelease: false
148
- requirement: &id009 !ruby/object:Gem::Requirement
101
+ version_requirements: *2166051540
102
+ - !ruby/object:Gem::Dependency
103
+ name: nokogiri
104
+ requirement: &2166044680 !ruby/object:Gem::Requirement
149
105
  none: false
150
- requirements:
151
- - - ">="
152
- - !ruby/object:Gem::Version
153
- hash: 3
154
- segments:
155
- - 0
156
- version: "0"
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
157
110
  type: :development
158
- version_requirements: *id009
159
- - !ruby/object:Gem::Dependency
160
- name: activesupport
161
111
  prerelease: false
162
- requirement: &id010 !ruby/object:Gem::Requirement
112
+ version_requirements: *2166044680
113
+ - !ruby/object:Gem::Dependency
114
+ name: activesupport
115
+ requirement: &2166043680 !ruby/object:Gem::Requirement
163
116
  none: false
164
- requirements:
117
+ requirements:
165
118
  - - ~>
166
- - !ruby/object:Gem::Version
167
- hash: 9
168
- segments:
169
- - 2
170
- - 3
171
- - 5
119
+ - !ruby/object:Gem::Version
172
120
  version: 2.3.5
173
121
  type: :development
174
- version_requirements: *id010
122
+ prerelease: false
123
+ version_requirements: *2166043680
175
124
  description: WebDriver-backed Watir
176
- email:
125
+ email:
177
126
  - jari.bakken@gmail.com
178
127
  executables: []
179
-
180
128
  extensions: []
181
-
182
129
  extra_rdoc_files: []
183
-
184
- files:
130
+ files:
185
131
  - .document
186
132
  - .gitignore
187
133
  - .gitmodules
@@ -194,6 +140,7 @@ files:
194
140
  - lib/watir-webdriver/atoms.rb
195
141
  - lib/watir-webdriver/atoms/README
196
142
  - lib/watir-webdriver/atoms/fireEvent.js
143
+ - lib/watir-webdriver/atoms/getAttribute.js
197
144
  - lib/watir-webdriver/atoms/getOuterHtml.js
198
145
  - lib/watir-webdriver/atoms/getParentElement.js
199
146
  - lib/watir-webdriver/atoms/selectText.js
@@ -249,7 +196,6 @@ files:
249
196
  - spec/element_locator_spec.rb
250
197
  - spec/element_spec.rb
251
198
  - spec/html/alerts.html
252
- - spec/html/keylogger.html
253
199
  - spec/html/special_chars.html
254
200
  - spec/html/wait.html
255
201
  - spec/implementation.rb
@@ -262,45 +208,35 @@ files:
262
208
  - watir-webdriver.gemspec
263
209
  homepage: http://github.com/jarib/watir-webdriver
264
210
  licenses: []
265
-
266
211
  post_install_message:
267
212
  rdoc_options: []
268
-
269
- require_paths:
213
+ require_paths:
270
214
  - lib
271
- required_ruby_version: !ruby/object:Gem::Requirement
215
+ required_ruby_version: !ruby/object:Gem::Requirement
272
216
  none: false
273
- requirements:
274
- - - ">="
275
- - !ruby/object:Gem::Version
276
- hash: 3
277
- segments:
278
- - 0
279
- version: "0"
280
- required_rubygems_version: !ruby/object:Gem::Requirement
217
+ requirements:
218
+ - - ! '>='
219
+ - !ruby/object:Gem::Version
220
+ version: '0'
221
+ required_rubygems_version: !ruby/object:Gem::Requirement
281
222
  none: false
282
- requirements:
283
- - - ">="
284
- - !ruby/object:Gem::Version
285
- hash: 3
286
- segments:
287
- - 0
288
- version: "0"
223
+ requirements:
224
+ - - ! '>='
225
+ - !ruby/object:Gem::Version
226
+ version: '0'
289
227
  requirements: []
290
-
291
228
  rubyforge_project: watir-webdriver
292
- rubygems_version: 1.8.9
229
+ rubygems_version: 1.8.10
293
230
  signing_key:
294
231
  specification_version: 3
295
232
  summary: Watir on WebDriver
296
- test_files:
233
+ test_files:
297
234
  - spec/alert_spec.rb
298
235
  - spec/browser_spec.rb
299
236
  - spec/container_spec.rb
300
237
  - spec/element_locator_spec.rb
301
238
  - spec/element_spec.rb
302
239
  - spec/html/alerts.html
303
- - spec/html/keylogger.html
304
240
  - spec/html/special_chars.html
305
241
  - spec/html/wait.html
306
242
  - spec/implementation.rb
@@ -1,15 +0,0 @@
1
- <html>
2
- <head>
3
- <meta http-equiv="Content-type" content="text/html; charset=utf-8">
4
- <title>Keylogger</title>
5
- <script type="text/javascript" charset="utf-8">
6
- function log (e) {
7
- document.getElementById('output').innerHTML += "<p>" + e.toString() + "</p>";
8
- }
9
- </script>
10
- </head>
11
- <body>
12
- <input type="text" id="receiver" onkeydown="log(this)">
13
- <div id="output"></div>
14
- </body>
15
- </html>