aranha-selenium 0.16.0 → 0.17.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18e3bb15941d38c6c927994436a4a4df762b245ab8b3abb9b068942792491d96
4
- data.tar.gz: 48c3891a06c7c23803cf1d638816e0c8b232739b0cfbbe71b36eac62c97b73fe
3
+ metadata.gz: c9482f8fde3c1307146bbf08cd227556d7a360cb933e032c0f56053c056fc5d7
4
+ data.tar.gz: 06f2c8d4e3837158196c805dd6a83887c6519cf48d139b431d244c02aec6b97b
5
5
  SHA512:
6
- metadata.gz: 5e831c4c948197ab2283e3b436a8b9228611d97bb6f67ed9c74f53378348889f25f67b5d0a6c73c9bf44bd24f43b6fafd944c4e45a0601f251e7ad538c6cd417
7
- data.tar.gz: 23604e89db94a014707a089bdb093b8f34b7600a7ec24b5efb552422e595a5610ec18f065ae7c7629193a6b0410674eea8ec61f77aae589a2c8040c5633ac5b5
6
+ metadata.gz: 53ed8288a5483aec8f6de02a736490523f7d7a1221b2a0913dafdd2baad19e7a449d5d8e8421cf38538a776f85843e169d133b5f06cf84caf0751663e16ad1fa
7
+ data.tar.gz: 01430a965794eeac8f23281e9a22de9218157f624e03357065bc36199e0995299c5dc3c15a9f8b3ba2f0219b03e346095ef3a208e2b6bf594da0d0d00d631919
@@ -15,7 +15,9 @@ module Aranha
15
15
  def chrome_options
16
16
  r = ::Selenium::WebDriver::Chrome::Options.new
17
17
  chrome_arguments.each { |arg| r.add_argument(arg) }
18
- r.add_preference(:download, prompt_for_download: false, default_directory: downloads_dir)
18
+ r.add_preference(:download, prompt_for_download: false,
19
+ default_directory: downloads_dir.to_path)
20
+ r.page_load_strategy = page_load_strategy if page_load_strategy.present?
19
21
  r
20
22
  end
21
23
 
@@ -21,6 +21,7 @@ module Aranha
21
21
  def build_options
22
22
  r = ::Selenium::WebDriver::Firefox::Options.new(args: build_args)
23
23
  r.accept_insecure_certs = accept_insecure_certs?
24
+ r.page_load_strategy = page_load_strategy if page_load_strategy.present?
24
25
  build_profile.if_present { |v| r.profile = v }
25
26
  r
26
27
  end
@@ -22,13 +22,14 @@ module Aranha
22
22
 
23
23
  enable_listable
24
24
  lists.add_symbol :headless, :auto, :no, :yes
25
- lists.add_symbol :option, :accept_insecure_certs, :downloads_dir, :headless, :profile_dir,
26
- :profile_name, :user_agent
25
+ lists.add_symbol :option, :accept_insecure_certs, :downloads_dir, :headless,
26
+ :page_load_strategy, :profile_dir, :profile_name, :user_agent
27
27
  BOOLEAN_OPTIONS = [OPTION_ACCEPT_INSECURE_CERTS, OPTION_HEADLESS].freeze
28
28
 
29
29
  DEFAULT_DOWNLOADS_DIR = ::File.join(::Dir.tmpdir, 'aranha_downloads_dir')
30
30
  DEFAULT_ACCEPT_INSECURE_CERTS = false
31
31
  DEFAULT_HEADLESS = HEADLESS_AUTO
32
+ DEFAULT_PAGE_LOAD_STRATEGY = nil
32
33
  DEFAULT_PROFILE_DIR = nil
33
34
  DEFAULT_PROFILE_NAME = nil
34
35
  DEFAULT_USER_AGENT = nil
@@ -36,6 +37,7 @@ module Aranha
36
37
  HEADLESS_AUTO_ENVVAR = 'DISPLAY'
37
38
 
38
39
  OPTIONS_SANITIZERS = {
40
+ downloads_dir: ->(value) { value.to_pathname },
39
41
  headless: lambda { |value|
40
42
  case value
41
43
  when HEADLESS_AUTO then ENV[HEADLESS_AUTO_ENVVAR].blank?
@@ -6,7 +6,6 @@ module Aranha
6
6
  module Selenium
7
7
  class Session < ::SimpleDelegator
8
8
  require_sub __FILE__, include_modules: true, require_mode: :kernel
9
- enable_simple_cache
10
9
 
11
10
  def initialize(options = {})
12
11
  super(
@@ -33,6 +32,14 @@ module Aranha
33
32
  def element(*find_args)
34
33
  ::Aranha::Selenium::Session::Element.new(self, find_args)
35
34
  end
35
+
36
+ # @yieldparam session [Aranha::Selenium::Session]
37
+ # @return [Object]
38
+ def quit_on_end
39
+ yield(self)
40
+ ensure
41
+ quit
42
+ end
36
43
  end
37
44
  end
38
45
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Aranha
4
4
  module Selenium
5
- VERSION = '0.16.0'
5
+ VERSION = '0.17.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aranha-selenium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
@@ -123,14 +123,14 @@ dependencies:
123
123
  requirements:
124
124
  - - "~>"
125
125
  - !ruby/object:Gem::Version
126
- version: '0.15'
126
+ version: '0.16'
127
127
  type: :development
128
128
  prerelease: false
129
129
  version_requirements: !ruby/object:Gem::Requirement
130
130
  requirements:
131
131
  - - "~>"
132
132
  - !ruby/object:Gem::Version
133
- version: '0.15'
133
+ version: '0.16'
134
134
  - !ruby/object:Gem::Dependency
135
135
  name: stub_server
136
136
  requirement: !ruby/object:Gem::Requirement