watir-classic 4.0.1 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,15 @@
1
+ == 4.1.0 - 2015/06/10
2
+
3
+ * Add text field support for number, email, url, search, and tel types (#68)
4
+ * Add support for locating all input elements via label text (#58)
5
+ * Add support for aria-* attributes when locating elements and retrieving attribute values
6
+ * Add support for String values for :tag_name locators (#62)
7
+ * Fix Button#value for button tags
8
+ * Fix Input#label to locate label using id (#57)
9
+ * Fix interacting with elements within modal dialog (#64)
10
+ * Fix Element#to_subtype for button, text and file inputs
11
+ * Fix Browser#execute_script returning wrong result (#75, thanks @michaelcm)
12
+
1
13
  == 4.0.1 - 2013/10/05
2
14
 
3
15
  * Bump win32screenshot dependency version.
@@ -39,7 +51,7 @@
39
51
  * Remove global variable $HIDE_IE - use IE.visible= method instead. Support for command line switch -b is also removed.
40
52
  * Remove global varialbe $FAST_SPEED - IE.speed= method instead. Support for command line switch -f is also removed.
41
53
  * Remove IE#close_all - use browser.windows.each(&:close) instead.
42
- * Remove IE#close_modal - use browser.modal_dialog.close instead.
54
+ * Remove IE#close_modal - use browser.modal_dialog.close instead.
43
55
  * Remove IE#close_others - use browser.windows.reject(&:current?).each(&:close) instead.
44
56
  * Remove unused ie-new-process.rb.
45
57
  * Remove unused PageContainer module.
@@ -50,7 +62,7 @@
50
62
 
51
63
  * Add support for optional Element#style property argument, which allows to get specific css style attribute value.
52
64
  * Add support for locating Link by a :name. Fixes #42.
53
- * Avoid endless loop when focusing elements inside of a frame. Closes #41.
65
+ * Avoid endless loop when focusing elements inside of a frame. Closes #41.
54
66
  * Cookies#delete handles the situation if browser is on about:blank.
55
67
  * Remove Image#file_created_date method since IE does not provide accurate information. Closes #36.
56
68
  * Use MultiJSON gem instead of the Yajl::Ruby gem as a dependency for parsing #execute_script results.
@@ -197,7 +209,7 @@
197
209
  - td => cell
198
210
  - tds => cells
199
211
  - a => link
200
- - as => links
212
+ - as => links
201
213
  - img => image
202
214
  - imgs => images
203
215
 
@@ -386,16 +398,16 @@ Charley Baker was release manager for this release of Watir.
386
398
  TextField#dragContentsTo => drag_contents_to
387
399
  Radio/Checkbox#isSet? => set?
388
400
  * Patch for winclicker fix. http://jira.openqa.org/browse/WTR-279 (Derek Berner)
389
- * Add support for using a Regexp as the third argument (value) when locating
401
+ * Add support for using a Regexp as the third argument (value) when locating
390
402
  checkboxes/radio buttons. (Jarib)
391
403
  * Add support for <strong> element. (Jarib)
392
404
  * Add support and tests for <em> element. (Jarib)
393
405
  * SelectList#select now supports Numeric arguments. (Jarib)
394
- * Additional inspect implementations for both IE and FF.
406
+ * Additional inspect implementations for both IE and FF.
395
407
  Closes http://jira.openqa.org/browse/WTR-158 (Jarib)
396
408
  * Add ElementCollections#{first,last}. (Jarib)
397
409
  * Fixes for running on Ruby 1.9. (Jarib)
398
-
410
+
399
411
  === Firefox Improvements
400
412
 
401
413
  * SelectList#set is now defined for Firefox. Like with IE, it is an alias for
@@ -404,25 +416,25 @@ Charley Baker was release manager for this release of Watir.
404
416
  and @map@ to be used with methods such as @divs@ and @links@.
405
417
  * FireWatir.attach is now available, analogous to IE.attach. Includes http://jira.openqa.org/browse/WTR-296
406
418
  * Some Javascript errors that were being ignored, now raise Ruby exceptions.
407
- * Added event handler which resets the context of document
419
+ * Added event handler which resets the context of document
408
420
  * Fix bug that occurred when new page was automatically loaded. (Angrez, 3ef8b6)
409
421
  when page gets loaded automatically (Angrez)
410
- * Changed code to use document_var, body_var, window_var, browser_var instead of
422
+ * Changed code to use document_var, body_var, window_var, browser_var instead of
411
423
  "document", "body", "window", "browser" variables. (Angrez)
412
- * Changed code to replace every quote (") in xpath query with (\") so that it
424
+ * Changed code to replace every quote (") in xpath query with (\") so that it
413
425
  doesn't give error while executing the xpath query (Angrez)
414
426
  * Fire onchange event for FireWatir file fields. Closes http://jira.openqa.org/browse/WTR-286. (Jarib)
415
427
  * Fixes for running and closing Firefox on Mac OS X http://jira.openqa.org/browse/WTR-272 (Jarib)
416
- * Added functionality to allow Watir::Browser.attach with no arguments to open
428
+ * Added functionality to allow Watir::Browser.attach with no arguments to open
417
429
  a new firefox window rather than taking over the existing focused window (Rob Aldred)
418
- * Also modified some setup functions to correctly handle closed browsers,
430
+ * Also modified some setup functions to correctly handle closed browsers,
419
431
  browserless windows and others (Rob Aldred)
420
432
  * Add test and implementation for Firefox#status http://jira.openqa.org/browse/WTR-250 (Jarib)
421
433
  * 2 problems fixed with .click (jubishop)
422
- a) When chaining together element calls the @container becomes an
434
+ a) When chaining together element calls the @container becomes an
423
435
  HTMLElement, but there's no container_var defined for HTMLElement
424
436
  b) When an <a tag has no href then element_type was returning nil.
425
- * Fix bug in Firefox#document. Change creating error class by eval in jssh
437
+ * Fix bug in Firefox#document. Change creating error class by eval in jssh
426
438
  socket to creating class with ruby. (Ethan)
427
439
  * Add support for Browser#frames. (Ethan)
428
440
  * Make the version dependencies for Watir and FireWatir be the same. (This change
@@ -433,7 +445,7 @@ Charley Baker was release manager for this release of Watir.
433
445
  * Allow attach timeout to be accessed as an option. Thus:
434
446
  IE.set_options :attach_timeout => 5.0
435
447
  This was previously available as class method.
436
- * Fix for Autoit auto-registration. (Bret)
448
+ * Fix for Autoit auto-registration. (Bret)
437
449
  * Fixes http://jira.openqa.org/browse/WTR-290, http://jira.openqa.org/browse/WTR-308, http://jira.openqa.org/browse/WTR-298
438
450
  * Fix for IE6, 7 and 8 file uploads. (Zeljko Filipin & Jarmo Pertman)
439
451
  * Replaced REXML with Nokogiri for xml parsing. Fixes http://jira.openqa.org/browse/WTR-19 (Aidy Lewis)
@@ -443,17 +455,17 @@ Charley Baker was release manager for this release of Watir.
443
455
  * Fix for Browser#execute_script on IE7. (Jarib)
444
456
  * Removed ActiveSupport dependency. (Jarib)
445
457
  * Fix Browser#status so it works even when the status bar is not visible. (Bret)
446
- * Fix bug when using "each" with nested tables.
458
+ * Fix bug when using "each" with nested tables.
447
459
  http://jira.openqa.org/browse/WTR-324 (Alan Baird)
448
460
  * Now uses UTF-8 codepage by default http://jira.openqa.org/browse/WTR-219 (Jarib)
449
461
 
450
462
  === Structure Improvements
451
463
 
452
- * Lots of rework of the FireWatir code, including removing duplication and
464
+ * Lots of rework of the FireWatir code, including removing duplication and
453
465
  dead code, renaming variables, and simplifying code. Also a few performance
454
466
  improvements. (Bret & Charley)
455
467
  * Rename source file names for consistency.
456
-
468
+
457
469
  === Unit Tests
458
470
 
459
471
  * Add tests demonstrating known bugs.
@@ -462,20 +474,20 @@ Charley Baker was release manager for this release of Watir.
462
474
  * Tag tests that are known to fail on IE or Firefox.
463
475
  * Fixed one test that was failing on non-English platforms. (Jarib)
464
476
  * New Rake task (:test) runs all tests. (Jim Matthews)
465
- * Use ci_reporter to provide more detailed test results for watirbuild.com.
477
+ * Use ci_reporter to provide more detailed test results for watirbuild.com.
466
478
  Use xls transform to format results. (Jim Matthews)
467
479
  * Add WatirSpec submodule + load it in Rakefile if available. (Jarib)
468
480
 
469
- == Version 1.6.2
481
+ == Version 1.6.2
470
482
 
471
483
  * Changed the method of setting Watir::Browser.default when the user does not
472
484
  specify a browser option. This fixes the problem where it would be 'ie' on
473
485
  Mac.
474
486
 
475
487
  * Fixed FireWatir's "text" method to return the same character's as Watir's
476
- method. It had been returning extra spaces and other characters.
488
+ method. It had been returning extra spaces and other characters.
477
489
  Fix included contribution from Tony. Closes #266
478
-
490
+
479
491
  * Fixed "activesupport" error. Users no longer need to have the latest version
480
492
  installed.
481
493
 
@@ -485,10 +497,10 @@ Charley Baker was release manager for this release of Watir.
485
497
 
486
498
  == Version 1.6.0
487
499
 
488
- This release merges the Watir and FireWatir projects. It contains many
500
+ This release merges the Watir and FireWatir projects. It contains many
489
501
  compatibility fixes,
490
502
  as well as a new browser-independent interface your tests can use to allow you
491
- to specify the browser at run time.
503
+ to specify the browser at run time.
492
504
 
493
505
  We have also updated our existing support for modal dialogs so that it now works
494
506
  with Ruby 1.8.6. Users who have been using Ruby 1.8.2 because of this will now
@@ -496,7 +508,7 @@ need to upgrade to Ruby 1.8.6.
496
508
 
497
509
  This release also contains many other fixes. Details below.
498
510
 
499
- Watir and FireWatir are still distributed as separate gems. Installing the
511
+ Watir and FireWatir are still distributed as separate gems. Installing the
500
512
  Watir gem will automatically install FireWatir. Both gems now use common code
501
513
  contained in the "commonwatir" gem.
502
514
 
@@ -509,13 +521,13 @@ To install both Watir and FireWatir:
509
521
 
510
522
  gem update --system
511
523
  gem install watir
512
-
524
+
513
525
  To only install FireWatir (e.g. on Mac or Linux)
514
526
 
515
527
  gem update --system
516
528
  gem install firewatir
517
-
518
- To enable Firefox to work with Watir, you will also need to install the
529
+
530
+ To enable Firefox to work with Watir, you will also need to install the
519
531
  JSSH plugin. See this page for details.
520
532
  http://wiki.openqa.org/display/WTR/FireWatir+Installation#FireWatirInstallation-3%29InstalltheJSSHFirefoxExtension
521
533
 
@@ -533,7 +545,7 @@ In addition to 'browser', options supported by Browser.new (on IE only right now
533
545
  are 'speed' and 'visible'.
534
546
 
535
547
  Unit tests no longer run from the gems. You will need to get the source if you
536
- want to run the unit tests.
548
+ want to run the unit tests.
537
549
 
538
550
  === Compatibility Fixes
539
551
  * FireWatir now raises Watir exceptions.
@@ -541,7 +553,7 @@ want to run the unit tests.
541
553
  * Watir now supports multiple attributes for most page elements.
542
554
  * Added support to FireWatir for many more element types.
543
555
  * Added Radio#checked? and Checkbox#checked? methods to FireWatir.
544
- * Now firefox.radio().set will click a radio button (as does IE) even if it
556
+ * Now firefox.radio().set will click a radio button (as does IE) even if it
545
557
  is already set. This is important if there is javascript attached to the
546
558
  radio button.
547
559
  * TextField#set now respects the maxlength of the field. Previously, FireWatir
@@ -555,20 +567,20 @@ want to run the unit tests.
555
567
  * Watir#wait_until is now available to FireWatir.
556
568
  * Fixed versioning. With FireWatir 1.2.1, FireWatir::Firefox::VERSION
557
569
  actually reported '1.1.1.'.
558
- * FireWatir will now automatically starts Firefox on Mac (as it did previously
570
+ * FireWatir will now automatically starts Firefox on Mac (as it did previously
559
571
  on Windows and Linux).
560
572
 
561
573
  === IE Fixes
562
- * Fix for: form field named "submit" causes "submit" method to not work.
574
+ * Fix for: form field named "submit" causes "submit" method to not work.
563
575
  Closes #223.
564
576
  * Calling ie.radio().set now scrolls the page to the control, as with other
565
577
  controls. Thanks to Jonathan Kohl for the fix. Closes #172.
566
578
  * Fixed ie.speed, which was returning ":fast" when speed was actually ":zippy".
567
- * Fix for visible? method not being inherited correctly. From Alan Baird.
579
+ * Fix for visible? method not being inherited correctly. From Alan Baird.
568
580
  Closes #253
569
581
  * Added ie.forms method. Thanks to Jarmo P.
570
582
  * Fix for "undefined method 'document'" error that was occuring when loading
571
- pages with frames that were slow to load. Reported here:
583
+ pages with frames that were slow to load. Reported here:
572
584
  http://groups.google.com/group/watir-general/browse_thread/thread/ddde6251e30588c9
573
585
  * Fixed accessing checkboxes and radio buttons using :ole_object on IE.
574
586
  Closes #217.
@@ -578,7 +590,7 @@ want to run the unit tests.
578
590
  from a complete source tree.
579
591
  * New rake targets for Watir: test and cruise, each of which runs the core tests.
580
592
  * Numerous fixes and cleanup to the unit test suite.
581
- * The unit tests both both Watir and FireWatir now use the new Browser.new
593
+ * The unit tests both both Watir and FireWatir now use the new Browser.new
582
594
  interface and can be run
583
595
  against either implementation (Watir::IE or FireWatir::Firefox or others for
584
596
  that matter). See this page for details.
@@ -613,7 +625,7 @@ To install this:
613
625
 
614
626
  Installer Fix
615
627
 
616
- This update fixes an installer problem in Watir 1.5.5 that affected some users.
628
+ This update fixes an installer problem in Watir 1.5.5 that affected some users.
617
629
  If you installed 1.5.5 without error, there is no reason to get this update.
618
630
 
619
631
  == Watir 1.5.5.
@@ -621,13 +633,13 @@ If you installed 1.5.5 without error, there is no reason to get this update.
621
633
  New Features
622
634
 
623
635
  * Multiple attributes can now be specified for these elements:
624
- li, ul, map, area, h1, h2, h3, h4, h5, h6. (This was claimed to work earlier,
636
+ li, ul, map, area, h1, h2, h3, h4, h5, h6. (This was claimed to work earlier,
625
637
  but never did.)
626
638
  http://jira.openqa.org/browse/WTR-196
627
639
 
628
640
  Bug Fixes
629
641
 
630
- * Statements such at ie.table().row() now work (no longer private).
642
+ * Statements such at ie.table().row() now work (no longer private).
631
643
  http://jira.openqa.org/browse/WTR-117
632
644
  * Fixed bug with images method when used with anything but ie. (Paul Rogers)
633
645
  E.g. ie.div().images. http://jira.openqa.org/browse/WTR-211
@@ -640,11 +652,11 @@ Bug Fixes
640
652
  http://jira.openqa.org/browse/WTR-181
641
653
  * Made examples and unit tests somewhat better examples: removed unnecessary
642
654
  "include Watir" statements; started using "browser" instead of "$ie"; use
643
- new methods 'goto_page' and 'uses_page' (this last improves performance of
644
- unit tests).
655
+ new methods 'goto_page' and 'uses_page' (this last improves performance of
656
+ unit tests).
645
657
  http://jira.openqa.org/browse/WTR-159
646
658
  * Moved brittle unit test that was causing cascading failures; renamed another
647
- that was causing a namespace collision.
659
+ that was causing a namespace collision.
648
660
  http://jira.openqa.org/browse/WTR-92
649
661
 
650
662
  == Version 1.5.4
@@ -653,7 +665,7 @@ New Features
653
665
 
654
666
  * Add new speed, :zippy. This is like fast, but, in effect, it does a TextField#value= instead of a TextField#set. If you have specific text fields that you never want this to happen to, use ie.text_field(:how, what).requires_typing.set instead.
655
667
  http://svn.openqa.org/fisheye/changelog/watir/?cs=1295
656
- * Add support for Chinese input as supplied by Vincent Xu.
668
+ * Add support for Chinese input as supplied by Vincent Xu.
657
669
  http://jira.openqa.org/browse/WTR-71.
658
670
 
659
671
  Bug Fixes
@@ -677,15 +689,15 @@ Bug fixes and minor cleanup.
677
689
  * Update documentation.
678
690
 
679
691
  Major Changes in 1.5.2
680
- Support for IE's Modal Dialogs.
681
- showModalDialog()
682
- Any method can be used to specify an element (:text, :class, etc.).
692
+ Support for IE's Modal Dialogs.
693
+ showModalDialog()
694
+ Any method can be used to specify an element (:text, :class, etc.).
683
695
  ie.button(:class,'Button Menu').click
684
696
  ie.div(:text, 'Type').text_field(:class, 'TextInput-input').set('my value')
685
- ie.button(:text, 'Save').click
697
+ ie.button(:text, 'Save').click
686
698
  One can now use multiple attributes to specify an element.
687
699
  ie.span(:class =>'Label', :text => 'Add new').click
688
-
700
+
689
701
  Other Changes in 1.5.2
690
702
  * Migrated IE.new_process from watir/contrib and improved its reliability. We now recommend IE.new_process over IE.new as a way to avoid numerous errors detailed in http://jira.openqa.org/browse/WTR-150.
691
703
  * Added IE.start_process. This works like IE.start, but uses the new_process mechanism to start IE.
@@ -743,7 +755,7 @@ Other Changes in 1.5.2
743
755
  * Released new IE.new_process method to 'watir/contrib/ie-new-process'. This starts up a new IE process for each IE window, which is really how it should be done. To close these use IE#kill. Any one getting intermittent RPC errors when opening windows may want to use this instead.
744
756
  * Several examples have been updated.
745
757
  * Moved enabled_popup to a new contrib directory.
746
- * Added several tests.
758
+ * Added several tests.
747
759
 
748
760
  Changes in 1.4
749
761
  fix method name for accessing class name of P/Span/Div (change from style to class_name)
@@ -788,7 +800,7 @@ Changes in 1.3
788
800
  added index to print out from show_xx methods. Link shows img src if an image is used
789
801
  added onKeyUp and onKeyDown to text_fields#set
790
802
  installer now installs AutoIt to deal with javascript popups, file uploads etc
791
- the spinner is now off by default
803
+ the spinner is now off by default
792
804
  bug fix in text_fields iterator where it wasnt iterating through password or text ares. Added test for password fields
793
805
  bug fix for flash for tables
794
806
  bug fixes for images and links in cells
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.0.1
1
+ 4.1.0
@@ -88,15 +88,25 @@ module Watir
88
88
  def to_subtype
89
89
  assert_exists
90
90
 
91
- tag = tag_name
91
+ tag = tag_name.downcase
92
92
  if tag == "html"
93
93
  element(:ole_object => ole_object)
94
94
  elsif tag == "input"
95
- send(ole_object.invoke('type'), :ole_object => ole_object)
96
- elsif tag == "select"
97
- select_list(:ole_object => ole_object)
98
- elsif respond_to?(tag.downcase)
99
- send(tag.downcase, :ole_object => ole_object)
95
+ input_type = case ole_object.invoke("type")
96
+ when *%w[button reset submit image]
97
+ "button"
98
+ when "checkbox"
99
+ "checkbox"
100
+ when "radio"
101
+ "radio"
102
+ when "file"
103
+ "file_field"
104
+ else
105
+ "text_field"
106
+ end
107
+ send(input_type, :ole_object => ole_object)
108
+ elsif respond_to?(tag)
109
+ send(tag, :ole_object => ole_object)
100
110
  else
101
111
  self
102
112
  end
@@ -113,7 +123,7 @@ module Watir
113
123
  end
114
124
 
115
125
  # Retrieve element's css style.
116
- # @param [String] property When property is specified then only css for that property is returned.
126
+ # @param [String] property When property is specified then only css for that property is returned.
117
127
  # @return [String] css style as a one long String.
118
128
  # @return [String] css style for specified property if property parameter is specified.
119
129
  # @macro exists
@@ -249,7 +259,7 @@ module Watir
249
259
  # @macro exists
250
260
  def visible?
251
261
  # Now iterate up the DOM element tree and return false if any
252
- # parent element isn't visible
262
+ # parent element isn't visible
253
263
  assert_exists
254
264
  visible_child = false
255
265
  object = @o
@@ -296,7 +306,7 @@ module Watir
296
306
  ruby_code = generate_ruby_code(self, $1, *args)
297
307
  system(spawned_no_wait_command(ruby_code))
298
308
  end
299
- elsif meth =~ /^data_(.*)/
309
+ elsif meth =~ /^(aria|data)_(.+)$/
300
310
  self.send(:attribute_value, meth.gsub("_", "-")) || ''
301
311
  else
302
312
  super
@@ -306,7 +316,7 @@ module Watir
306
316
  # @private
307
317
  def locate
308
318
  @o = @container.locator_for(TaggedElementLocator, @specifiers, self.class).locate
309
- end
319
+ end
310
320
 
311
321
  # @private
312
322
  def __ole_inner_elements
@@ -440,7 +450,7 @@ module Watir
440
450
  def build_method(method_name, *args)
441
451
  arguments = args.map do |argument|
442
452
  if argument.is_a?(String)
443
- argument = "'#{argument}'"
453
+ argument = "'#{argument}'"
444
454
  else
445
455
  argument = argument.inspect
446
456
  end
@@ -480,4 +490,4 @@ module Watir
480
490
  end
481
491
 
482
492
  end
483
- end
493
+ end
@@ -10,6 +10,11 @@ module Watir
10
10
  attr_ole :src
11
11
  attr_ole :type
12
12
 
13
+ # @return [String] text field label's text.
14
+ def label
15
+ @container.label(:for => id).text
16
+ end
17
+
13
18
  # @private
14
19
  def locate
15
20
  @o = @container.locator_for(InputElementLocator, @specifiers, self.class).locate
@@ -40,8 +45,8 @@ module Watir
40
45
  def select(item)
41
46
  matching_options = []
42
47
  perform_action do
43
- matching_options = matching_items_in_select_list(:text, item) +
44
- matching_items_in_select_list(:label, item) +
48
+ matching_options = matching_items_in_select_list(:text, item) +
49
+ matching_items_in_select_list(:label, item) +
45
50
  matching_items_in_select_list(:value, item)
46
51
  raise NoValueFoundException, "No option with :text, :label or :value of #{item.inspect} in this select element" if matching_options.empty?
47
52
  matching_options.each(&:select)
@@ -177,11 +182,13 @@ module Watir
177
182
  # @return [String] button contents of value attribute or inner text if there's no value.
178
183
  # @see Element#text
179
184
  def text
180
- val = __value
185
+ val = tag_name == "button" ? super : __value
181
186
  val.empty? ? super : val
182
187
  end
183
188
 
184
- alias_method :value, :text
189
+ def value
190
+ tag_name == "button" ? attribute_value("value") : text
191
+ end
185
192
  end
186
193
 
187
194
  # Returned be {Container#text_field}.
@@ -201,11 +208,6 @@ module Watir
201
208
  end
202
209
  end
203
210
 
204
- # @return [String] text field label's text.
205
- def label
206
- @container.label(:for => name).text
207
- end
208
-
209
211
  # Clear the contents of the text field.
210
212
  #
211
213
  # @macro exists
@@ -338,7 +340,7 @@ module Watir
338
340
  # @private
339
341
  def assert_not_readonly
340
342
  if self.readonly?
341
- raise ObjectReadOnlyException,
343
+ raise ObjectReadOnlyException,
342
344
  "Textfield #{@specifiers.inspect} is read only."
343
345
  end
344
346
  end
@@ -360,14 +362,14 @@ module Watir
360
362
  end
361
363
 
362
364
  # Supports double-byte characters
363
- def characters_in(value, &blk)
365
+ def characters_in(value, &blk)
364
366
  if RUBY_VERSION =~ /^1\.8/
365
367
  index = 0
366
- while index < value.length
368
+ while index < value.length
367
369
  len = value[index] > 128 ? 2 : 1
368
370
  yield value[index, len]
369
371
  index += len
370
- end
372
+ end
371
373
  else
372
374
  value.each_char(&blk)
373
375
  end
@@ -8,7 +8,7 @@ module Watir
8
8
  def initialize container, specifiers, klass
9
9
  @container = container
10
10
  @specifiers = {:index => 0}.merge(normalize_specifiers(specifiers))
11
- @tags = @specifiers.delete(:tag_name)
11
+ @tags = [@specifiers.delete(:tag_name)].flatten
12
12
  @klass = klass
13
13
  end
14
14
 
@@ -43,7 +43,7 @@ module Watir
43
43
  when :class
44
44
  how = :class_name
45
45
  when :caption
46
- how = :value
46
+ how = :text
47
47
  when :method
48
48
  how = :form_method
49
49
  when :value
@@ -15,6 +15,11 @@ module Watir
15
15
  document.title
16
16
  end
17
17
 
18
+ # Brings the modal dialog to front.
19
+ def focus
20
+ @modal.activate
21
+ end
22
+
18
23
  # Close the modal dialog.
19
24
  #
20
25
  # @param [Fixnum] timeout timeout in seconds to wait until modal dialog is
@@ -1,3 +1,5 @@
1
+ require 'securerandom'
2
+
1
3
  module Watir
2
4
  # A PageContainer contains an HTML Document. In other words, it is a
3
5
  # what JavaScript calls a Window.
@@ -24,7 +26,7 @@ module Watir
24
26
  result = document.parentWindow.eval(source)
25
27
  rescue WIN32OLERuntimeError, NoMethodError #if eval fails we need to use execScript(source.to_s) which does not return a value, hence the workaround
26
28
  escaped_src = source.gsub(/\r?\n/, "\\n").gsub("'", "\\\\'")
27
- wrapper = "_watir_helper_div_#{::Time.now.to_i + ::Time.now.usec}"
29
+ wrapper = "_watir_helper_div_#{SecureRandom.uuid}"
28
30
  cmd = "var e = document.createElement('DIV'); e.style.display='none'; e.id='#{wrapper}'; e.innerHTML = eval('#{escaped_src}'); document.body.appendChild(e);"
29
31
  document.parentWindow.execScript(cmd)
30
32
  result = document.getElementById(wrapper).innerHTML
@@ -18,7 +18,7 @@ module Watir
18
18
  # browser.$1(:id => "htmlid")
19
19
  #
20
20
  # @example Search by any arbitrary html attribute:
21
- # browser.$1(:foo => "value-of-foo-attribute)
21
+ # browser.$1(:foo => "value-of-foo-attribute")
22
22
  #
23
23
  # @example Search by multiple attributes, all provided locators should evaluate to true - only then element is considered to be found:
24
24
  # browser.$1(:text => "some text", :class => "css class")
@@ -164,7 +164,7 @@ module Watir
164
164
  support_element :table
165
165
  support_element :tbody, :class => :TableSection
166
166
  support_element :td, :tag_name => [:th, :td], :class => :TableCell
167
- support_element :text_field, :tag_name => [:text, :password, :textarea], :class => :TextField, :super_class => :InputElement
167
+ support_element :text_field, :tag_name => [:text, :password, :textarea, :number, :email, :url, :search, :tel], :class => :TextField, :super_class => :InputElement
168
168
  support_element :textarea, :class => :TextArea, :super_class => :TextField, :super_collection => :InputElement
169
169
  support_element :tfoot, :class => :TableSection
170
170
  support_element :th
metadata CHANGED
@@ -1,60 +1,68 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watir-classic
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.1.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Bret Pettichord
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-10-05 00:00:00.000000000 Z
12
+ date: 2015-06-10 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: win32-process
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - '>='
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: 0.5.5
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - '>='
27
+ - - ! '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: 0.5.5
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: windows-pr
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - '>='
35
+ - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: 0.6.6
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - '>='
43
+ - - ! '>='
39
44
  - !ruby/object:Gem::Version
40
45
  version: 0.6.6
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: nokogiri
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - '>='
51
+ - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: 1.5.7.rc3
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - '>='
59
+ - - ! '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: 1.5.7.rc3
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: ffi
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
67
  - - ~>
60
68
  - !ruby/object:Gem::Version
@@ -62,6 +70,7 @@ dependencies:
62
70
  type: :runtime
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
75
  - - ~>
67
76
  - !ruby/object:Gem::Version
@@ -69,6 +78,7 @@ dependencies:
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: rautomation
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
83
  - - ~>
74
84
  - !ruby/object:Gem::Version
@@ -76,6 +86,7 @@ dependencies:
76
86
  type: :runtime
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
91
  - - ~>
81
92
  - !ruby/object:Gem::Version
@@ -83,20 +94,23 @@ dependencies:
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: multi_json
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
- - - '>='
99
+ - - ! '>='
88
100
  - !ruby/object:Gem::Version
89
101
  version: '0'
90
102
  type: :runtime
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
- - - '>='
107
+ - - ! '>='
95
108
  - !ruby/object:Gem::Version
96
109
  version: '0'
97
110
  - !ruby/object:Gem::Dependency
98
111
  name: win32screenshot
99
112
  requirement: !ruby/object:Gem::Requirement
113
+ none: false
100
114
  requirements:
101
115
  - - ~>
102
116
  - !ruby/object:Gem::Version
@@ -104,6 +118,7 @@ dependencies:
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
107
122
  requirements:
108
123
  - - ~>
109
124
  - !ruby/object:Gem::Version
@@ -111,6 +126,7 @@ dependencies:
111
126
  - !ruby/object:Gem::Dependency
112
127
  name: rspec
113
128
  requirement: !ruby/object:Gem::Requirement
129
+ none: false
114
130
  requirements:
115
131
  - - ~>
116
132
  - !ruby/object:Gem::Version
@@ -118,6 +134,7 @@ dependencies:
118
134
  type: :development
119
135
  prerelease: false
120
136
  version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
121
138
  requirements:
122
139
  - - ~>
123
140
  - !ruby/object:Gem::Version
@@ -125,83 +142,91 @@ dependencies:
125
142
  - !ruby/object:Gem::Dependency
126
143
  name: syntax
127
144
  requirement: !ruby/object:Gem::Requirement
145
+ none: false
128
146
  requirements:
129
- - - '>='
147
+ - - ! '>='
130
148
  - !ruby/object:Gem::Version
131
149
  version: '0'
132
150
  type: :development
133
151
  prerelease: false
134
152
  version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
135
154
  requirements:
136
- - - '>='
155
+ - - ! '>='
137
156
  - !ruby/object:Gem::Version
138
157
  version: '0'
139
158
  - !ruby/object:Gem::Dependency
140
159
  name: yard
141
160
  requirement: !ruby/object:Gem::Requirement
161
+ none: false
142
162
  requirements:
143
- - - '>='
163
+ - - ! '>='
144
164
  - !ruby/object:Gem::Version
145
165
  version: '0'
146
166
  type: :development
147
167
  prerelease: false
148
168
  version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
149
170
  requirements:
150
- - - '>='
171
+ - - ! '>='
151
172
  - !ruby/object:Gem::Version
152
173
  version: '0'
153
174
  - !ruby/object:Gem::Dependency
154
175
  name: sinatra
155
176
  requirement: !ruby/object:Gem::Requirement
177
+ none: false
156
178
  requirements:
157
- - - '>='
179
+ - - ! '>='
158
180
  - !ruby/object:Gem::Version
159
181
  version: '0'
160
182
  type: :development
161
183
  prerelease: false
162
184
  version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
163
186
  requirements:
164
- - - '>='
187
+ - - ! '>='
165
188
  - !ruby/object:Gem::Version
166
189
  version: '0'
167
190
  - !ruby/object:Gem::Dependency
168
191
  name: childprocess
169
192
  requirement: !ruby/object:Gem::Requirement
193
+ none: false
170
194
  requirements:
171
- - - '>='
195
+ - - ! '>='
172
196
  - !ruby/object:Gem::Version
173
197
  version: '0'
174
198
  type: :development
175
199
  prerelease: false
176
200
  version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
177
202
  requirements:
178
- - - '>='
203
+ - - ! '>='
179
204
  - !ruby/object:Gem::Version
180
205
  version: '0'
181
206
  - !ruby/object:Gem::Dependency
182
207
  name: rake
183
208
  requirement: !ruby/object:Gem::Requirement
209
+ none: false
184
210
  requirements:
185
- - - '>='
211
+ - - ! '>='
186
212
  - !ruby/object:Gem::Version
187
213
  version: '0'
188
214
  type: :development
189
215
  prerelease: false
190
216
  version_requirements: !ruby/object:Gem::Requirement
217
+ none: false
191
218
  requirements:
192
- - - '>='
219
+ - - ! '>='
193
220
  - !ruby/object:Gem::Version
194
221
  version: '0'
195
- description: |2
196
- WATIR is "Web Application Testing in Ruby". Watir (pronounced water) is a free,
197
- open-source functional testing tool for automating browser-based tests of web applications.
198
- It works with applications written in any language.
199
- Watir drives the Internet Explorer browser the same way an end user would.
200
- It clicks links, fills in forms, presses buttons.
201
- Watir also checks results, such as whether expected text appears on the
202
- page, or whether a control is enabled.
203
- Watir can test web applications written in any language.
204
- Watir is a Ruby library that works with Internet Explorer on Windows.
222
+ description: ! " WATIR is \"Web Application Testing in Ruby\". Watir (pronounced
223
+ water) is a free,\n open-source functional testing tool for automating browser-based
224
+ tests of web applications.\n It works with applications written in any language.\n
225
+ \ Watir drives the Internet Explorer browser the same way an end user would.\n
226
+ \ It clicks links, fills in forms, presses buttons.\n Watir also checks results,
227
+ such as whether expected text appears on the\n page, or whether a control is
228
+ enabled.\n Watir can test web applications written in any language.\n Watir
229
+ is a Ruby library that works with Internet Explorer on Windows.\n"
205
230
  email: watir-general@groups.google.com
206
231
  executables: []
207
232
  extensions: []
@@ -281,27 +306,28 @@ files:
281
306
  - watir-classic.gemspec
282
307
  homepage: http://watir.com/
283
308
  licenses: []
284
- metadata: {}
285
309
  post_install_message:
286
310
  rdoc_options: []
287
311
  require_paths:
288
312
  - lib
289
313
  required_ruby_version: !ruby/object:Gem::Requirement
314
+ none: false
290
315
  requirements:
291
- - - '>='
316
+ - - ! '>='
292
317
  - !ruby/object:Gem::Version
293
318
  version: '0'
294
319
  required_rubygems_version: !ruby/object:Gem::Requirement
320
+ none: false
295
321
  requirements:
296
- - - '>='
322
+ - - ! '>='
297
323
  - !ruby/object:Gem::Version
298
324
  version: '0'
299
325
  requirements:
300
326
  - Microsoft Windows running Internet Explorer 5.5 or later.
301
327
  rubyforge_project:
302
- rubygems_version: 2.0.7
328
+ rubygems_version: 1.8.23
303
329
  signing_key:
304
- specification_version: 4
330
+ specification_version: 3
305
331
  summary: Automated testing tool for web applications.
306
332
  test_files:
307
333
  - spec/browser_spec.rb
@@ -311,4 +337,3 @@ test_files:
311
337
  - spec/implementation.rb
312
338
  - spec/link_spec.rb
313
339
  - spec/select_list_spec.rb
314
- has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 20be9a143cf2810b7548a9d30c89bd749c836d0a
4
- data.tar.gz: 0a6316b858a39fcf55273d9931a3173772f552dd
5
- SHA512:
6
- metadata.gz: c75f3a51393ba43ade31df0084676294e48e1f4dfc653682d20e89fdeef45093095e91821fed161c58374cd2c990c3de23c04b3d1ebc3adfc57a47b55d6d6a35
7
- data.tar.gz: a10319410d4a3e0ac3ccc222f3195f2da0dd571e202a2bc502f86f275f3edfd9d4439dfa7857faab36949a7e6dd1d5dbbe81b46da6d6a76ec0840c5349128704