fe_core_ext 0.30.1 → 0.33.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8418dd8035fa99643b26a7960e1f3cf1e16bb0e4605aa64bf8febb14aaf36eda
4
- data.tar.gz: ea17906cfd926562a7c39b2ec7460e91b4d232649923389fc7480b3652a151de
3
+ metadata.gz: e03934108a512eada22df20a49377eacbcc98decb4cf1ef976a6b4a68625d878
4
+ data.tar.gz: 47c126a960a3c00b535ad7c0de71a00dd891bf1c3df80a25e252376ea0c32bb9
5
5
  SHA512:
6
- metadata.gz: 3122f6848091b0fe21a382273895705bfc8ccdf6cf71419fdb487924985e502b87959f6144449d285fae9b98de1b8ff73e130aa731e040f921f3b48a341c82fa
7
- data.tar.gz: d82eecef2cd089d5c93e40f2d6bfbda73fa99d2e6ed21b1033d36bc732b964da5d6e0376729e1c0fa70f5929fda16cbdcfffabc2dcf232aadd90aa235c0af734
6
+ metadata.gz: b0237b7d187495a4362e7cd499cafefd9ac5a4ba0092a7e6988c98cccfeef01c6022a6e7f175dc2224d24f768cf513ee7d478bab6cfd84042d58dd6b06e88d01
7
+ data.tar.gz: 0e2294134a6b53bbe9cebd60e311549220559429ac5586b02914ce036d34948df94e13a279b9b63ed70f833441169c2f637eb3f2fbdae4bfdf705120dd01a634
data/fe_core_ext.gemspec CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_runtime_dependency "activesupport"
23
23
  spec.add_development_dependency "bundler", "~> 2.1"
24
24
  spec.add_development_dependency "rake", "~> 12.3"
25
- spec.add_development_dependency "rspec", "~> 0"
26
- spec.add_development_dependency "selenium-webdriver", "~> 0"
25
+
26
+ spec.add_development_dependency "ferrum"
27
+ spec.add_development_dependency "selenium-webdriver"
27
28
  end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ferrum
4
+ class Browser
5
+ delegate %i[wait_for_css wait_for_csses wait_for_xpath wait_for_xpaths], to: :page
6
+ end
7
+
8
+ class Page
9
+ delegate %i[wait_for_css wait_for_csses wait_for_xpath wait_for_xpaths], to: :main_frame
10
+ end
11
+
12
+ class Frame
13
+ module DOM
14
+ def wait_for_csses(selector, timeout: 3)
15
+ wait_for_selector(selector, :css, timeout)
16
+ end
17
+
18
+ def wait_for_xpaths(selector, timeout: 3)
19
+ wait_for_selector(selector, :xpath, timeout)
20
+ end
21
+
22
+ def wait_for_css(selector, timeout: 3)
23
+ wait_for_selector(selector, :at_css, timeout)
24
+ end
25
+
26
+ def wait_for_xpath(selector, timeout: 3)
27
+ wait_for_selector(selector, :at_xpath, timeout)
28
+ end
29
+
30
+ private
31
+
32
+ def wait_for_selector(selector, selector_method, timeout)
33
+ interval = 0.1
34
+ (timeout / interval).to_i.times do
35
+ nodes = send(selector_method, selector)
36
+ return nodes if nodes
37
+ sleep(interval)
38
+ end
39
+ nil
40
+ end
41
+ end
42
+ end
43
+ end
@@ -1,46 +1,50 @@
1
- module Selenium::WebDriver::Find
2
- def find_element_without_no_element_error(*args)
3
- find_element(*args)
4
- rescue Selenium::WebDriver::Error::NoSuchElementError
5
- nil
6
- end
1
+ module Selenium
2
+ module WebDriver
3
+ module Find
4
+ def find_element_without_no_element_error(*args)
5
+ find_element(*args)
6
+ rescue Selenium::WebDriver::Error::NoSuchElementError
7
+ nil
8
+ end
7
9
 
8
- def find_elements_without_no_element_error(*args)
9
- find_elements(*args)
10
- rescue Selenium::WebDriver::Error::NoSuchElementError
11
- nil
12
- end
10
+ def find_elements_without_no_element_error(*args)
11
+ find_elements(*args)
12
+ rescue Selenium::WebDriver::Error::NoSuchElementError
13
+ nil
14
+ end
13
15
 
14
- def at_xpath(path, wait: nil)
15
- if wait.present?
16
- driver_wait = Selenium::WebDriver::Wait.new(timeout: wait)
17
- driver_wait.until { find_element_without_no_element_error(:xpath, path) }
18
- end
19
- find_element_without_no_element_error(:xpath, path)
20
- end
16
+ def at_xpath(path, wait: nil)
17
+ if wait.present?
18
+ driver_wait = Selenium::WebDriver::Wait.new(timeout: wait)
19
+ driver_wait.until { find_element_without_no_element_error(:xpath, path) }
20
+ end
21
+ find_element_without_no_element_error(:xpath, path)
22
+ end
21
23
 
22
- def xpath(path, wait: nil)
23
- if wait.present?
24
- driver_wait = Selenium::WebDriver::Wait.new(timeout: wait)
25
- driver_wait.until { find_elements_without_no_element_error(:xpath, path) }
26
- end
27
- find_elements_without_no_element_error(:xpath, path)
28
- end
24
+ def xpath(path, wait: nil)
25
+ if wait.present?
26
+ driver_wait = Selenium::WebDriver::Wait.new(timeout: wait)
27
+ driver_wait.until { find_elements_without_no_element_error(:xpath, path) }
28
+ end
29
+ find_elements_without_no_element_error(:xpath, path)
30
+ end
29
31
 
30
- def at_css(path, wait: nil)
31
- if wait.present?
32
- driver_wait = Selenium::WebDriver::Wait.new(timeout: wait)
33
- driver_wait.until { find_element_without_no_element_error(:css, path) }
34
- end
35
- find_element_without_no_element_error(:css, path)
36
- end
32
+ def at_css(path, wait: nil)
33
+ if wait.present?
34
+ driver_wait = Selenium::WebDriver::Wait.new(timeout: wait)
35
+ driver_wait.until { find_element_without_no_element_error(:css, path) }
36
+ end
37
+ find_element_without_no_element_error(:css, path)
38
+ end
37
39
 
38
- def css(path, wait: nil)
39
- if wait.present?
40
- driver_wait = Selenium::WebDriver::Wait.new(timeout: wait)
41
- driver_wait.until { find_elements_without_no_element_error(:css, path) }
40
+ def css(path, wait: nil)
41
+ if wait.present?
42
+ driver_wait = Selenium::WebDriver::Wait.new(timeout: wait)
43
+ driver_wait.until { find_elements_without_no_element_error(:css, path) }
44
+ end
45
+ find_elements_without_no_element_error(:css, path)
46
+ end
42
47
  end
43
- find_elements_without_no_element_error(:css, path)
44
48
  end
45
49
  end
46
50
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FeCoreExt
4
- VERSION = "0.30.1"
4
+ VERSION = "0.33.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fe_core_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.30.1
4
+ version: 0.33.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tetsu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-08 00:00:00.000000000 Z
11
+ date: 2023-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -53,31 +53,31 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '12.3'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rspec
56
+ name: ferrum
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: selenium-webdriver
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: Core class extensions that doesn't supported by active_recored core_ext
@@ -109,6 +109,7 @@ files:
109
109
  - lib/fe_core_ext/core_ext/time.rb
110
110
  - lib/fe_core_ext/core_ext/uri.rb
111
111
  - lib/fe_core_ext/gem_ext.rb
112
+ - lib/fe_core_ext/gem_ext/ferrum.rb
112
113
  - lib/fe_core_ext/gem_ext/selenium_webdriver.rb
113
114
  - lib/fe_core_ext/version.rb
114
115
  homepage: http://github.com/ironsand/fe_core_ext