watir 6.17.0 → 7.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 (142) hide show
  1. checksums.yaml +4 -4
  2. data/.github/actions/enable-safari/action.yml +11 -0
  3. data/.github/actions/install-chrome/action.yml +12 -0
  4. data/.github/actions/setup-linux/action.yml +8 -0
  5. data/.github/workflows/chrome.yml +34 -0
  6. data/.github/workflows/edge.yml +28 -0
  7. data/.github/workflows/firefox.yml +35 -0
  8. data/.github/workflows/ie.yml +24 -0
  9. data/.github/workflows/safari.yml +27 -0
  10. data/.github/workflows/unit.yml +52 -0
  11. data/.rubocop.yml +3 -8
  12. data/.rubocop_todo.yml +36 -0
  13. data/CHANGES.md +91 -0
  14. data/LICENSE +2 -2
  15. data/README.md +6 -10
  16. data/Rakefile +2 -2
  17. data/lib/watir/adjacent.rb +1 -1
  18. data/lib/watir/alert.rb +4 -8
  19. data/lib/watir/attribute_helper.rb +3 -1
  20. data/lib/watir/browser.rb +23 -9
  21. data/lib/watir/capabilities.rb +120 -106
  22. data/lib/watir/cell_container.rb +4 -4
  23. data/lib/watir/container.rb +4 -26
  24. data/lib/watir/cookies.rb +2 -0
  25. data/lib/watir/element_collection.rb +21 -6
  26. data/lib/watir/elements/checkbox.rb +4 -4
  27. data/lib/watir/elements/date_field.rb +8 -5
  28. data/lib/watir/elements/date_time_field.rb +8 -5
  29. data/lib/watir/elements/element.rb +85 -67
  30. data/lib/watir/elements/file_field.rb +4 -4
  31. data/lib/watir/elements/font.rb +5 -4
  32. data/lib/watir/elements/hidden.rb +4 -4
  33. data/lib/watir/elements/html_elements.rb +444 -446
  34. data/lib/watir/elements/iframe.rb +6 -6
  35. data/lib/watir/elements/radio.rb +6 -6
  36. data/lib/watir/elements/select.rb +62 -90
  37. data/lib/watir/elements/svg_elements.rb +96 -96
  38. data/lib/watir/elements/table.rb +1 -1
  39. data/lib/watir/elements/text_field.rb +4 -4
  40. data/lib/watir/generator/base/generator.rb +4 -4
  41. data/lib/watir/generator/base/visitor.rb +0 -29
  42. data/lib/watir/generator/html/generator.rb +2 -1
  43. data/lib/watir/has_window.rb +22 -18
  44. data/lib/watir/http_client.rb +9 -0
  45. data/lib/watir/js_execution.rb +2 -2
  46. data/lib/watir/js_snippets/isElementInViewport.js +20 -0
  47. data/lib/watir/js_snippets.rb +2 -2
  48. data/lib/watir/locators/button/matcher.rb +0 -23
  49. data/lib/watir/locators/button/selector_builder/xpath.rb +4 -15
  50. data/lib/watir/locators/element/matcher.rb +4 -19
  51. data/lib/watir/locators/element/selector_builder/xpath.rb +37 -43
  52. data/lib/watir/locators/element/selector_builder.rb +3 -41
  53. data/lib/watir/locators/option/matcher.rb +24 -0
  54. data/lib/watir/locators/option/selector_builder/xpath.rb +37 -0
  55. data/lib/watir/locators/option/selector_builder.rb +8 -0
  56. data/lib/watir/locators.rb +6 -8
  57. data/lib/watir/logger.rb +4 -91
  58. data/lib/watir/radio_set.rb +5 -4
  59. data/lib/watir/row_container.rb +4 -4
  60. data/lib/watir/screenshot.rb +2 -8
  61. data/lib/watir/scroll.rb +2 -1
  62. data/lib/watir/user_editable.rb +13 -2
  63. data/lib/watir/version.rb +1 -1
  64. data/lib/watir/wait/timer.rb +1 -1
  65. data/lib/watir/wait.rb +6 -74
  66. data/lib/watir/window.rb +46 -25
  67. data/lib/watir/window_collection.rb +79 -0
  68. data/lib/watir.rb +4 -45
  69. data/lib/watirspec/guards.rb +1 -1
  70. data/lib/watirspec/implementation.rb +7 -5
  71. data/lib/watirspec/remote_server.rb +2 -6
  72. data/lib/watirspec/runner.rb +2 -2
  73. data/lib/watirspec/server.rb +2 -2
  74. data/lib/watirspec.rb +5 -2
  75. data/spec/spec_helper.rb +1 -21
  76. data/spec/unit/capabilities_spec.rb +654 -21
  77. data/spec/unit/match_elements/button_spec.rb +0 -13
  78. data/spec/unit/match_elements/element_spec.rb +55 -51
  79. data/spec/unit/match_elements/text_field_spec.rb +6 -6
  80. data/spec/unit/selector_builder/element_spec.rb +6 -23
  81. data/spec/unit/selector_builder/text_field_spec.rb +6 -7
  82. data/spec/unit/unit_helper.rb +2 -4
  83. data/spec/watirspec/after_hooks_spec.rb +23 -44
  84. data/spec/watirspec/alert_spec.rb +4 -21
  85. data/spec/watirspec/browser_spec.rb +186 -206
  86. data/spec/watirspec/cookies_spec.rb +47 -52
  87. data/spec/watirspec/drag_and_drop_spec.rb +17 -7
  88. data/spec/watirspec/elements/area_spec.rb +1 -5
  89. data/spec/watirspec/elements/button_spec.rb +4 -18
  90. data/spec/watirspec/elements/checkbox_spec.rb +10 -24
  91. data/spec/watirspec/elements/date_field_spec.rb +13 -16
  92. data/spec/watirspec/elements/date_time_field_spec.rb +11 -13
  93. data/spec/watirspec/elements/dd_spec.rb +3 -4
  94. data/spec/watirspec/elements/del_spec.rb +10 -12
  95. data/spec/watirspec/elements/div_spec.rb +56 -84
  96. data/spec/watirspec/elements/divs_spec.rb +2 -2
  97. data/spec/watirspec/elements/dl_spec.rb +4 -12
  98. data/spec/watirspec/elements/element_spec.rb +283 -187
  99. data/spec/watirspec/elements/elements_spec.rb +8 -9
  100. data/spec/watirspec/elements/filefield_spec.rb +5 -7
  101. data/spec/watirspec/elements/form_spec.rb +3 -5
  102. data/spec/watirspec/elements/forms_spec.rb +3 -5
  103. data/spec/watirspec/elements/frame_spec.rb +17 -22
  104. data/spec/watirspec/elements/iframe_spec.rb +25 -33
  105. data/spec/watirspec/elements/ins_spec.rb +10 -12
  106. data/spec/watirspec/elements/link_spec.rb +23 -23
  107. data/spec/watirspec/elements/links_spec.rb +8 -9
  108. data/spec/watirspec/elements/radio_spec.rb +11 -14
  109. data/spec/watirspec/elements/select_list_spec.rb +358 -209
  110. data/spec/watirspec/elements/span_spec.rb +12 -14
  111. data/spec/watirspec/elements/spans_spec.rb +1 -1
  112. data/spec/watirspec/elements/strong_spec.rb +1 -1
  113. data/spec/watirspec/elements/table_nesting_spec.rb +31 -34
  114. data/spec/watirspec/elements/table_spec.rb +11 -13
  115. data/spec/watirspec/elements/tbody_spec.rb +10 -12
  116. data/spec/watirspec/elements/td_spec.rb +4 -6
  117. data/spec/watirspec/elements/text_field_spec.rb +10 -12
  118. data/spec/watirspec/elements/tr_spec.rb +5 -7
  119. data/spec/watirspec/html/non_control_elements.html +8 -3
  120. data/spec/watirspec/html/scroll.html +8 -25
  121. data/spec/watirspec/html/special_chars.html +3 -0
  122. data/spec/watirspec/html/sticky_elements.html +10 -0
  123. data/spec/watirspec/html/wait.html +5 -5
  124. data/spec/watirspec/html/window_switching.html +10 -0
  125. data/spec/watirspec/scroll_spec.rb +72 -42
  126. data/spec/watirspec/special_chars_spec.rb +10 -0
  127. data/spec/watirspec/support/rspec_matchers.rb +11 -24
  128. data/spec/watirspec/user_editable_spec.rb +26 -28
  129. data/spec/watirspec/wait_spec.rb +154 -201
  130. data/spec/watirspec/window_switching_spec.rb +385 -270
  131. data/spec/watirspec_helper.rb +54 -49
  132. data/support/doctest_helper.rb +0 -2
  133. data/watir.gemspec +5 -6
  134. metadata +38 -41
  135. data/.travis.yml +0 -87
  136. data/appveyor.yml +0 -13
  137. data/lib/watir/legacy_wait.rb +0 -123
  138. data/spec/implementation_spec.rb +0 -24
  139. data/spec/unit/container_spec.rb +0 -35
  140. data/spec/unit/logger_spec.rb +0 -81
  141. data/spec/watirspec/html/hover.html +0 -12
  142. data/spec/watirspec/relaxed_locate_spec.rb +0 -109
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c587621e41c1ab878d2e9ff3cfd6c5166c5df9dc66cd02c0719d492aaba48d1e
4
- data.tar.gz: 509ba43afa0272d7b154eb5885e403578e2bc3956ab93803123b519093e7b430
3
+ metadata.gz: e8a3f59dcd9f56e63cf532cc2ba8c9605e8ffad78bd59d3f104e6677c9f5e20c
4
+ data.tar.gz: 1f1cb55a4270ebdce957f4a8dc33e76403eef391ed59e3179f4f6772595d3f59
5
5
  SHA512:
6
- metadata.gz: 5215ff9fc1cfce6fa050532583167e6ed16be6f74b0d305b8d186b83361162c711ae9b63689a00882bf60d559783508ea2369ed9e8d5e25b504688eb2914db01
7
- data.tar.gz: 1b0ba276ea5c83f217151c125b0f645aab7011d86d9049ea7850ea83af4fbeeb9bdfa14ca60d7205c55bee3c0d6f817143bd9f979c7dc5adc368af446367ab8a
6
+ metadata.gz: 488c6b2f0a93a20390350da8b95025f9e33d2be9bb7bd84b130808906bca067860b3db6908c59961ef3914ccbb682d2d15d2418656749f8916a1416fa8c6cbb5
7
+ data.tar.gz: 64bc4a7b36c294a75ceb86c3fea21809dbefc158cbca08ba72dc6bf7b3b64d76f04b5c02130a8cce15e78d5156659cb317ee397e27d93d06e537e804695e425b
@@ -0,0 +1,11 @@
1
+ name: 'Enable Safari Driver'
2
+ description: 'Set safaridriver to run in automation mode'
3
+ runs:
4
+ using: composite
5
+ steps:
6
+ - run: |
7
+ defaults write com.apple.Safari IncludeDevelopMenu YES
8
+ defaults write com.apple.Safari AllowRemoteAutomation 1
9
+ sudo safaridriver --enable
10
+ safaridriver -p 0 &
11
+ shell: bash
@@ -0,0 +1,12 @@
1
+ name: 'Install Chrome'
2
+ description: 'Install Chrome Stable'
3
+ runs:
4
+ using: "composite"
5
+ steps:
6
+ - run: |
7
+ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
8
+ echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list.d/google-chrome.list
9
+ sudo apt-get update -qqy
10
+ sudo apt-get -qqy install google-chrome-stable
11
+ sudo rm /etc/apt/sources.list.d/google-chrome.list
12
+ shell: bash
@@ -0,0 +1,8 @@
1
+ name: 'Setup Linux'
2
+ description: 'Run Linux in Virtual Desktop'
3
+ runs:
4
+ using: "composite"
5
+ steps:
6
+ - shell: bash
7
+ run: |
8
+ Xvfb :99 &
@@ -0,0 +1,34 @@
1
+ name: Chrome Tests
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+
7
+ jobs:
8
+ local-tests:
9
+ name: Local Tests
10
+ runs-on: ${{ matrix.os }}
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ os: [ubuntu-latest, macos-latest, windows-latest]
15
+ ruby: [ 2.6, 3.0 ]
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ - uses: ./.github/actions/setup-linux
19
+ if: matrix.os == 'ubuntu-latest'
20
+ - uses: ./.github/actions/install-chrome
21
+ if: matrix.os == 'ubuntu-latest'
22
+ - run: |
23
+ echo "COVERAGE=true" >> $GITHUB_ENV
24
+ if: |
25
+ matrix.os == 'ubuntu-latest' ||
26
+ matrix.os == 'macos-latest'
27
+ - uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: ${{ matrix.ruby }}
30
+ - run: bundle install
31
+ - run: |
32
+ bundle exec rake spec:chrome
33
+ env:
34
+ DISPLAY: :99
@@ -0,0 +1,28 @@
1
+ name: Edge Tests
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+
7
+ jobs:
8
+ local-tests:
9
+ name: Local Tests
10
+ runs-on: ${{ matrix.os }}
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ os: [macos-latest, windows-latest]
15
+ ruby: [ 2.6, 3.0 ]
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ - run: |
19
+ echo "COVERAGE=true" >> $GITHUB_ENV
20
+ if: matrix.os == 'macos-latest'
21
+ - uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: ${{ matrix.ruby }}
24
+ - run: bundle install
25
+ - run: |
26
+ bundle exec rake spec:edge
27
+ env:
28
+ DISPLAY: :99
@@ -0,0 +1,35 @@
1
+ name: Firefox Tests
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+
7
+ jobs:
8
+ local-tests:
9
+ name: Local Tests
10
+ runs-on: ${{ matrix.os }}
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ os: [ubuntu-latest, macos-latest, windows-latest]
15
+ ruby: [ 2.6, 3.0 ]
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ - uses: ./.github/actions/setup-linux
19
+ if: matrix.os == 'ubuntu-latest'
20
+ - uses: browser-actions/setup-firefox@latest
21
+ with:
22
+ firefox-version: '93.0'
23
+ - run: |
24
+ echo "COVERAGE=true" >> $GITHUB_ENV
25
+ if: |
26
+ matrix.os == 'ubuntu-latest' ||
27
+ matrix.os == 'macos-latest'
28
+ - uses: ruby/setup-ruby@v1
29
+ with:
30
+ ruby-version: ${{ matrix.ruby }}
31
+ - run: bundle install
32
+ - run: |
33
+ bundle exec rake spec:firefox
34
+ env:
35
+ DISPLAY: :99
@@ -0,0 +1,24 @@
1
+ name: IE Tests
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+
7
+ jobs:
8
+ local-tests:
9
+ name: Local Tests
10
+ runs-on: windows-latest
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ ruby: [ 2.6, 3.0 ]
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ - run: bundle install
21
+ - run: |
22
+ bundle exec rake spec:ie
23
+ env:
24
+ DISPLAY: :99
@@ -0,0 +1,27 @@
1
+ name: Safari Tests
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+
7
+ jobs:
8
+ local-tests:
9
+ name: Local Tests
10
+ runs-on: macos-latest
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ ruby: [ 2.6, 3.0 ]
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - uses: ./.github/actions/enable-safari
18
+ - run: |
19
+ echo "COVERAGE=true" >> $GITHUB_ENV
20
+ - uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: ${{ matrix.ruby }}
23
+ - run: bundle install
24
+ - run: |
25
+ bundle exec rake spec:safari
26
+ env:
27
+ DISPLAY: :99
@@ -0,0 +1,52 @@
1
+ name: Unit Tests
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+
7
+ jobs:
8
+ documentation-test:
9
+ name: Yard Doctest
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+ - uses: ruby/setup-ruby@v1
14
+ with:
15
+ ruby-version: 2.6
16
+ - run: bundle install
17
+ - uses: ./.github/actions/install-chrome
18
+ - uses: ./.github/actions/setup-linux
19
+ - run: |
20
+ bundle exec rake yard:doctest
21
+
22
+
23
+ unit-test:
24
+ name: Unit Tests
25
+ runs-on: ubuntu-latest
26
+ strategy:
27
+ fail-fast: false
28
+ matrix:
29
+ ruby: ['2.6', '2.7', '3.0']
30
+ steps:
31
+ - uses: actions/checkout@v2
32
+ - uses: ruby/setup-ruby@v1
33
+ with:
34
+ ruby-version: ${{ matrix.ruby }}
35
+ - run: bundle install
36
+ - uses: ./.github/actions/install-chrome
37
+ - uses: ./.github/actions/setup-linux
38
+ - run: |
39
+ bundle exec rake spec:unit
40
+ env:
41
+ DISPLAY: :99
42
+
43
+ linter-test:
44
+ name: Rubocop Tests
45
+ runs-on: ubuntu-latest
46
+ steps:
47
+ - uses: actions/checkout@v2
48
+ - uses: ruby/setup-ruby@v1
49
+ with:
50
+ ruby-version: 2.6
51
+ - run: bundle install
52
+ - run: bundle exec rubocop
data/.rubocop.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
3
  AllCops:
4
- TargetRubyVersion: 2.5.8
4
+ TargetRubyVersion: 2.6.8
5
5
  NewCops: enable
6
6
  Exclude:
7
7
  - 'lib/watir/elements/html_elements.rb'
@@ -19,17 +19,12 @@ Lint/UnifiedInteger:
19
19
 
20
20
  # Default: 17
21
21
  Metrics/AbcSize:
22
- Max: 20
22
+ Max: 22
23
23
  Exclude:
24
- - 'lib/watir/capabilities.rb'
25
24
  - 'lib/watir/locators/element/selector_builder.rb'
26
- - 'lib/watir/locators/element/selector_builder/regexp_disassembler.rb'
27
- - 'lib/watir/locators/element/selector_builder/xpath.rb'
28
- - 'lib/watir/locators/element/locator.rb'
25
+ - 'lib/watir/locators/element/selector_builder/*.rb'
29
26
  - 'lib/watir/generator/base/generator.rb'
30
- - 'lib/watir/generator/base/visitor.rb'
31
27
  - 'spec/locator_spec_helper.rb'
32
- - 'spec/watirspec_helper.rb'
33
28
 
34
29
  Metrics/BlockLength:
35
30
  Exclude:
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,36 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2020-08-27 01:55:04 UTC using RuboCop version 0.89.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 116
10
+ Style/Documentation:
11
+ Enabled: false
12
+
13
+ # Offense count: 11
14
+ # Configuration parameters: EnforcedStyle.
15
+ # SupportedStyles: annotated, template, unannotated
16
+ Style/FormatStringToken:
17
+ Exclude:
18
+ - 'lib/watir/browser.rb'
19
+ - 'lib/watir/window.rb'
20
+
21
+ # Offense count: 229
22
+ # Cop supports --auto-correct.
23
+ # Configuration parameters: EnforcedStyle.
24
+ # SupportedStyles: always, always_true, never
25
+ Style/FrozenStringLiteralComment:
26
+ Enabled: false
27
+
28
+ # Remove for Watir 7
29
+ Naming/FileName:
30
+ Exclude:
31
+ - 'lib/watir-webdriver.rb'
32
+
33
+ # Fix in Watir 7
34
+ Metrics/ParameterLists:
35
+ Exclude:
36
+ - 'lib/watir/wait.rb'
data/CHANGES.md CHANGED
@@ -1,3 +1,94 @@
1
+ ### 7.1.0 (2021-11-15)
2
+
3
+ * Add automatic scroll to `Element#click` with method parameters to ensure element is in viewport
4
+ * Provide `:scroll_to` parameter for element methods implemented with `Actions` class (thanks osadasami #948, #949)
5
+ * Allow `:scroll_to` parameter to accept `nil` argument to avoid automatic scrolling
6
+ * Implement `Element#in_viewport?`
7
+ * Fix but where `Scroll#to` for `Browser` with `:center` argument did not scroll to center of page
8
+ * Change `Element#obscured?` to only scroll when element out of viewport and then scroll to bottom instead of top
9
+
10
+ ### 7.0.0 (2021-10-18)
11
+
12
+ * Requires Selenium 4.0.0+
13
+ * Requires Ruby 2.6+
14
+ * Implement `Window#minimize`
15
+ * Implement `Window#full_screen`
16
+
17
+ ### 7.0.0.beta5 (2021-08-02)
18
+
19
+ * Add support for passing in Proxy and proxy Hash to Capabilities (#933)
20
+ * Trigger change event when setting values on date and date-time fields (#938)
21
+ * Allow user to obtain Capabilities instance from Browser instance
22
+
23
+ ### 7.0.0.beta4 (2021-05-29)
24
+
25
+ * Fix Bug in using negative class names within a collection (#934)
26
+
27
+ ### 7.0.0.beta3 (2021-05-05)
28
+
29
+ * Fix Bug preventing proper use of vendor extension capabilities
30
+ * Changed how timeouts are supported in Watir Capabilities (#932)
31
+ * Changed the default Alert Behavior not to automatically get dismissed when an exception happens (#931)
32
+
33
+ ### 7.0.0.beta2 (2021-03-28)
34
+
35
+ * Replace Watir Logger implementation with Selenium Logger subclass
36
+ * Change Watir Guards to use Selenium's new Guards. Tests run as pending when guarded.
37
+ * Implement `#set` as standard interface for each Input Element (#405)
38
+ * Implement `Element#set` to take correct `#set` behavior based on evaluated element (#664)
39
+ * Optimize Performance for Select Lists (#846)
40
+ * Allow user to set values on Select List exclusively by `:label`, `:text`, or `:value` (#846)
41
+ * Allow user to check if option selected in Select List by `:label`, `:text`, or `:value` (#929)
42
+ * Implement `Window#restore!` to return to original Window and close all others (#923)
43
+ * Minor performance improvement for iterating over windows (#923)
44
+ * Implement `Browser#closed?`; same as `Browser#exists?` without the Windows checks (#923)
45
+ * Update methods that use Selenium's Actions class to scroll element into view before acting (#847)
46
+ * Fix bug for `:text` locator with `Regexp` value based on whitespace (#924)
47
+ * Remove executing after hooks when changing frames (#888)
48
+
49
+ ### 7.0.0.beta1 (2021-03-18)
50
+
51
+ * Requires Selenium 4
52
+ * Supports Ruby 3
53
+ * Add support for Microsoft Edge Chromium
54
+ * Remove support for all deprecated functionality
55
+
56
+ ### 6.19.1 (2021-03-17)
57
+
58
+ * Fix bug preventing using Selenium 4
59
+ * Fix bug preventing non-xml characters in attributes (#787)
60
+
61
+ ### 6.19.0 (2021-03-12)
62
+
63
+ * Create custom Watir HTTP Client
64
+ * Require minimum of Selenium 3.142.7
65
+ * Add support for starting browser with :http_client and :service hashes
66
+ * Allow inferring desired browser from Capabilities or Options if browser not specified
67
+ * Deprecate WindowCollection#to_a method
68
+ * Deprecate starting browser with both Capabilities and Options
69
+ * Deprecate starting browser with both URL and Service
70
+ * Deprecate using :desired_capabilities
71
+ * Deprecate starting browser service keywords in top level Hash
72
+ * Deprecate using :remote to start a browser; browser name must be specified
73
+ * Deprecate sending unknown keywords into the top level
74
+ * Fix bug preventing Safari Options from being recognized
75
+ * Fix bug preventing options provided without :remote keyword from being properly recognized (#812, #870)
76
+ * Fix bug preventing :headless from being recognized when :options specified (#692)
77
+
78
+ ### 6.18.0 (2021-02-26)
79
+
80
+ * Implement `WindowCollection` to manage multiple `Window` objects
81
+ * Add support for locating `Window` by `:element`
82
+ * Deprecate locating `Window` by `:index`
83
+ * Deprecate `Select#select_all` in favor of `#select` and an `Array`
84
+ * Implement `Browser#switch_window` (#849)
85
+ * Add support for `Numeric` attribute values to `Waitable`
86
+ * Allow users to specify Selenium 4 in their projects
87
+ * Update stale element handling behavior to match webdriver spec (#905 #909)
88
+ * Implement `Waitable` for `ElementCollection` (#853 #857)
89
+ * Improve performance for nested elements (#843)
90
+ * Less strict version check for `regexp_parser` gem (thanks Pavel Lobashov)
91
+
1
92
  ### 6.17.0 (2020-08-27)
2
93
  * Require Ruby > 2.5
3
94
  * Implement Logger#selenium= to set selenium level from Watir
data/LICENSE CHANGED
@@ -1,8 +1,8 @@
1
1
  (the MIT License)
2
2
 
3
3
  Copyright (c) 2009-2015 Jari Bakken
4
- Copyright (c) 2015-2018 Alex Rodionov, Titus Fortner
5
- Copyright (c) 2018 Justin Ko
4
+ Copyright (c) 2015-2021 Alex Rodionov, Titus Fortner
5
+ Copyright (c) 2018-2021 Justin Ko
6
6
 
7
7
  Permission is hereby granted, free of charge, to any person obtaining
8
8
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -3,10 +3,9 @@
3
3
  Watir Powered By Selenium!
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/watir.svg)](http://badge.fury.io/rb/watir)
6
- [![Travis Status](https://travis-ci.org/watir/watir.svg?branch=master)](https://travis-ci.org/watir/watir)
7
- [![AppVeyor status](https://ci.appveyor.com/api/projects/status/9vbb7pp5p4uyoott/branch/master?svg=true)](https://ci.appveyor.com/project/p0deje/watir)
6
+ [![All Tests](https://github.com/watir/watir/actions/workflows/tests.yml/badge.svg)](https://github.com/watir/watir/actions/workflows/tests.yml)
8
7
  [![Code Climate](https://codeclimate.com/github/watir/watir.svg)](https://codeclimate.com/github/watir/watir)
9
- [![Coverage Status](https://coveralls.io/repos/github/watir/watir/badge.svg?branch=master)](https://coveralls.io/github/watir/watir?branch=master)
8
+ [![Coverage Status](https://coveralls.io/repos/github/watir/watir/badge.svg?branch=main)](https://coveralls.io/github/watir/watir?branch=main)
10
9
 
11
10
  ## Using Watir
12
11
 
@@ -69,11 +68,11 @@ $ bundle exec rake svg:update
69
68
 
70
69
  ## Specs
71
70
 
72
- #### Travis CI
71
+ #### Github Actions
73
72
 
74
- Watir specs are run on [Travis CI](https://travis-ci.org/watir/watir).
73
+ Watir specs are run with [Github Actions](https://github.com/watir/watir/workflows).
75
74
 
76
- Watir code is tested with 2.3, 2.4 and 2.5 versions in multiple browsers and with multiple configurations.
75
+ Watir code is tested on Linux with latest versions of supported browsers and all active Ruby versions.
77
76
 
78
77
  #### Doctests
79
78
 
@@ -95,7 +94,7 @@ to ensure all paths in their code have tests associated with them.
95
94
 
96
95
  Watir is using [Rubocop](https://github.com/rubocop-hq/rubocop) to ensure a consistent style across the
97
96
  code base. It is run with our minimum supported Ruby version (2.3)
98
- We have some [established exceptions](https://github.com/watir/watir/blob/master/.rubocop.yml)
97
+ We have some [established exceptions](https://github.com/watir/watir/blob/main/.rubocop.yml)
99
98
  that might need to be tweaked for new code submissions. This can be addressed in the PR as necessary.
100
99
 
101
100
  #### Statistics
@@ -107,7 +106,4 @@ on wire calls.
107
106
 
108
107
  ## Copyright
109
108
 
110
- Copyright (c) 2009-2015 Jari Bakken
111
- Copyright (c) 2015-2018 Alex Rodionov, Titus Fortner
112
- Copyright (c) 2018 Justin Ko
113
109
  See LICENSE for details
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ Bundler::GemHelper.install_tasks
5
5
 
6
6
  require 'rspec/core/rake_task'
7
7
  RSpec::Core::RakeTask.new(:spec) do |spec|
8
- spec.rspec_opts = %w[--color --require fuubar --format Fuubar]
8
+ spec.rspec_opts = %w[--color --format doc]
9
9
  spec.pattern = 'spec/**/*_spec.rb'
10
10
  spec.exclude_pattern = 'spec/unit/**/*_spec.rb'
11
11
  end
@@ -25,7 +25,7 @@ end
25
25
 
26
26
  {
27
27
  html: 'https://www.w3.org/TR/html52/single-page.html',
28
- svg: 'http://www.w3.org/TR/SVG2/single-page.html'
28
+ svg: 'https://www.w3.org/TR/2018/CR-SVG2-20180807/single-page.html'
29
29
  }.each do |type, spec_uri|
30
30
  namespace type do
31
31
  spec_path = "support/#{type}.html"
@@ -117,7 +117,7 @@ module Watir
117
117
  el = Watir.element_class_for(opt[:tag_name] || '').new(self, opt)
118
118
  el.is_a?(Input) ? el.to_subtype : el
119
119
  elsif opt[:tag_name]
120
- Object.const_get("#{Watir.element_class_for(opt[:tag_name])}Collection").new(self, opt)
120
+ Watir.const_get("#{Watir.element_class_for(opt[:tag_name])}Collection").new(self, opt)
121
121
  else
122
122
  HTMLElementCollection.new(self, opt)
123
123
  end
data/lib/watir/alert.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  module Watir
2
2
  class Alert
3
- include EventuallyPresent
4
3
  include Waitable
5
4
  include Exception
6
5
 
@@ -84,6 +83,7 @@ module Watir
84
83
  false
85
84
  end
86
85
  alias present? exists?
86
+ alias exist? exists?
87
87
 
88
88
  #
89
89
  # @api private
@@ -103,13 +103,9 @@ module Watir
103
103
  end
104
104
 
105
105
  def wait_for_exists
106
- return assert_exists unless Watir.relaxed_locate?
107
-
108
- begin
109
- wait_until(message: 'waiting for alert', &:exists?)
110
- rescue Wait::TimeoutError
111
- raise UnknownObjectException, 'unable to locate alert'
112
- end
106
+ wait_until(message: 'waiting for alert', &:exists?)
107
+ rescue Wait::TimeoutError
108
+ raise UnknownObjectException, 'unable to locate alert'
113
109
  end
114
110
  end # Alert
115
111
  end # Watir
@@ -29,7 +29,7 @@ module Watir
29
29
 
30
30
  def attribute_list
31
31
  @attribute_list ||= (typed_attributes.values.flatten +
32
- ancestors[1..-1].map { |e|
32
+ ancestors[1..].map { |e|
33
33
  e.attribute_list if e.respond_to?(:attribute_list)
34
34
  }.compact.flatten
35
35
  ).uniq
@@ -46,6 +46,8 @@ module Watir
46
46
  # @return [$1] value of $3 property
47
47
  #
48
48
  def attribute(type, method, attr)
49
+ return if method_defined?(method)
50
+
49
51
  typed_attributes[type] << [method, attr]
50
52
  define_attribute(type, method, attr)
51
53
  end
data/lib/watir/browser.rb CHANGED
@@ -12,7 +12,7 @@ module Watir
12
12
  include Scrolling
13
13
 
14
14
  attr_writer :default_context, :original_window, :locator_namespace, :timer
15
- attr_reader :driver, :after_hooks
15
+ attr_reader :driver, :after_hooks, :capabilities
16
16
  alias wd driver # ensures duck typing with Watir::Element
17
17
 
18
18
  class << self
@@ -42,8 +42,8 @@ module Watir
42
42
  def initialize(browser = :chrome, *args)
43
43
  case browser
44
44
  when ::Symbol, String
45
- selenium_args = Capabilities.new(browser, *args).to_args
46
- @driver = Selenium::WebDriver.for(*selenium_args)
45
+ @capabilities = Capabilities.new(browser, *args)
46
+ @driver = Selenium::WebDriver.for(*@capabilities.to_args)
47
47
  when Selenium::WebDriver::Driver
48
48
  @driver = browser
49
49
  else
@@ -55,16 +55,21 @@ module Watir
55
55
  @default_context = true
56
56
  end
57
57
 
58
+ # rubocop:disable Metrics/AbcSize
59
+ # TODO: w3c default behavior does not like checking if alert exists
58
60
  def inspect
59
61
  if alert.exists?
60
62
  format('#<%s:0x%x alert=true>', self.class, hash * 2)
61
63
  else
62
64
  format('#<%s:0x%x url=%s title=%s>', self.class, hash * 2, url.inspect, title.inspect)
63
65
  end
66
+ rescue Selenium::WebDriver::Error::NoSuchWindowError
67
+ format('#<%s:0x%x closed=%s>', self.class, hash * 2, closed?)
64
68
  rescue Errno::ECONNREFUSED
65
69
  format('#<%s:0x%x closed=true>', self.class, hash * 2)
66
70
  end
67
71
  alias selector_string inspect
72
+ # rubocop:enable Metrics/AbcSize
68
73
 
69
74
  #
70
75
  # Returns URL of current page.
@@ -101,13 +106,23 @@ module Watir
101
106
  #
102
107
 
103
108
  def close
104
- return if @closed
109
+ return if closed?
105
110
 
106
111
  @driver.quit
107
112
  @closed = true
108
113
  end
109
114
  alias quit close
110
115
 
116
+ #
117
+ # Returns true if browser is closed and false otherwise.
118
+ #
119
+ # @return [Boolean]
120
+ #
121
+
122
+ def closed?
123
+ @closed
124
+ end
125
+
111
126
  #
112
127
  # Handles cookies.
113
128
  #
@@ -213,11 +228,11 @@ module Watir
213
228
  # @param args Arguments will be available in the given script in the 'arguments' pseudo-array
214
229
  #
215
230
 
216
- def execute_script(script, *args)
231
+ def execute_script(script, *args, function_name: nil)
217
232
  args.map! do |e|
218
233
  e.is_a?(Element) ? e.wait_until(&:exists?).wd : e
219
234
  end
220
-
235
+ Watir.logger.info "Executing Script on Browser: #{function_name}" if function_name
221
236
  wrap_elements_in(self, @driver.execute_script(script, *args))
222
237
  end
223
238
 
@@ -252,12 +267,12 @@ module Watir
252
267
  #
253
268
 
254
269
  def exist?
255
- !@closed && window.present?
270
+ !closed? && window.present?
256
271
  end
257
272
  alias exists? exist?
258
273
 
259
274
  def locate
260
- raise Error, 'browser was closed' if @closed
275
+ raise Error, 'browser was closed' if closed?
261
276
 
262
277
  ensure_context
263
278
  end
@@ -267,7 +282,6 @@ module Watir
267
282
 
268
283
  driver.switch_to.default_content
269
284
  @default_context = true
270
- after_hooks.run
271
285
  end
272
286
 
273
287
  def browser