aranha-selenium 0.1.1 → 0.2.1
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:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: b7fc50afe38b2fde3f4762db0b2450ffb1f339312a0085ba6fe14f00e97654d6
         | 
| 4 | 
            +
              data.tar.gz: 86898571d2eee23c5a2b45aba50f73b4cd08f9bc092825ea793dd35dbd3e7d83
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: df1e65290f91144c048dfd3b6e376abc98f3c305c96698ed50517e5bfdc6edef3e098aae5f3ae17dc7a2c937c4fa67e1945ab3343267f979ab1ab5246a590707
         | 
| 7 | 
            +
              data.tar.gz: 9d39ecb22439f0a3aa0cc60b8c15405a8573b73ddce9ebbc7ea046f08dd04f8318c31e19ca0fa696c0625be3d18849915b0efbbae51665424966477ace78b01c
         | 
    
        data/Gemfile
    ADDED
    
    
| @@ -1,6 +1,8 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            +
            require 'active_support/json'
         | 
| 3 4 | 
             
            require 'active_support/core_ext/hash/indifferent_access'
         | 
| 5 | 
            +
            require 'selenium-webdriver'
         | 
| 4 6 | 
             
            require 'tmpdir'
         | 
| 5 7 |  | 
| 6 8 | 
             
            module Aranha
         | 
| @@ -55,6 +57,14 @@ module Aranha | |
| 55 57 | 
             
                      option_value(:headless)
         | 
| 56 58 | 
             
                    end
         | 
| 57 59 |  | 
| 60 | 
            +
                    def profile_dir
         | 
| 61 | 
            +
                      options[:profile_dir].to_s
         | 
| 62 | 
            +
                    end
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                    def profile_name
         | 
| 65 | 
            +
                      options[:profile_name]
         | 
| 66 | 
            +
                    end
         | 
| 67 | 
            +
             | 
| 58 68 | 
             
                    def user_agent
         | 
| 59 69 | 
             
                      option_value(:user_agent)
         | 
| 60 70 | 
             
                    end
         | 
| @@ -1,6 +1,5 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            -
            require 'selenium-webdriver'
         | 
| 4 3 | 
             
            require 'aranha/selenium/driver_factory/base'
         | 
| 5 4 |  | 
| 6 5 | 
             
            module Aranha
         | 
| @@ -15,14 +14,19 @@ module Aranha | |
| 15 14 |  | 
| 16 15 | 
             
                    def chrome_options
         | 
| 17 16 | 
             
                      r = ::Selenium::WebDriver::Chrome::Options.new
         | 
| 18 | 
            -
                      r.add_argument( | 
| 19 | 
            -
                      r.add_argument('--headless') if headless?
         | 
| 20 | 
            -
                      r.add_argument('--disable-popup-blocking')
         | 
| 21 | 
            -
                      r.add_argument('--disable-translate')
         | 
| 22 | 
            -
                      r.add_argument("user-agent=#{user_agent}") if user_agent.present?
         | 
| 17 | 
            +
                      chrome_arguments.each { |arg| r.add_argument(arg) }
         | 
| 23 18 | 
             
                      r.add_preference(:download, prompt_for_download: false, default_directory: downloads_dir)
         | 
| 24 19 | 
             
                      r
         | 
| 25 20 | 
             
                    end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                    def chrome_arguments
         | 
| 23 | 
            +
                      r = %w[--disable-popup-blocking --disable-translate]
         | 
| 24 | 
            +
                      r << '--ignore-certificate-errors' if accept_insecure_certs?
         | 
| 25 | 
            +
                      r << '--headless' if headless?
         | 
| 26 | 
            +
                      r << "--user-agent=#{user_agent}" if user_agent.present?
         | 
| 27 | 
            +
                      r << "--user-data-dir=#{profile_dir}" if profile_dir.present?
         | 
| 28 | 
            +
                      r
         | 
| 29 | 
            +
                    end
         | 
| 26 30 | 
             
                  end
         | 
| 27 31 | 
             
                end
         | 
| 28 32 | 
             
              end
         | 
| @@ -1,6 +1,5 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            -
            require 'selenium-webdriver'
         | 
| 4 3 | 
             
            require 'aranha/selenium/driver_factory/base'
         | 
| 5 4 |  | 
| 6 5 | 
             
            module Aranha
         | 
| @@ -10,10 +9,7 @@ module Aranha | |
| 10 9 | 
             
                    def build
         | 
| 11 10 | 
             
                      ::Selenium::WebDriver.for(
         | 
| 12 11 | 
             
                        :firefox,
         | 
| 13 | 
            -
                        options:  | 
| 14 | 
            -
                          profile: build_profile,
         | 
| 15 | 
            -
                          args: build_args
         | 
| 16 | 
            -
                        ),
         | 
| 12 | 
            +
                        options: build_options,
         | 
| 17 13 | 
             
                        desired_capabilities: build_capabilities
         | 
| 18 14 | 
             
                      )
         | 
| 19 15 | 
             
                    end
         | 
| @@ -22,7 +18,7 @@ module Aranha | |
| 22 18 |  | 
| 23 19 | 
             
                    def build_args
         | 
| 24 20 | 
             
                      r = []
         | 
| 25 | 
            -
                      r << ' | 
| 21 | 
            +
                      r << '--headless' if headless?
         | 
| 26 22 | 
             
                      r
         | 
| 27 23 | 
             
                    end
         | 
| 28 24 |  | 
| @@ -34,16 +30,33 @@ module Aranha | |
| 34 30 | 
             
                      end
         | 
| 35 31 | 
             
                    end
         | 
| 36 32 |  | 
| 37 | 
            -
                    def  | 
| 38 | 
            -
                      r = ::Selenium::WebDriver::Firefox:: | 
| 39 | 
            -
             | 
| 40 | 
            -
                      r | 
| 41 | 
            -
                      r | 
| 42 | 
            -
             | 
| 33 | 
            +
                    def build_options
         | 
| 34 | 
            +
                      r = ::Selenium::WebDriver::Firefox::Options.new(args: build_args,
         | 
| 35 | 
            +
                                                                      prefs: build_preferences)
         | 
| 36 | 
            +
                      build_profile.if_present { |v| r.profile = v }
         | 
| 37 | 
            +
                      r
         | 
| 38 | 
            +
                    end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                    def build_preferences
         | 
| 41 | 
            +
                      r = {
         | 
| 42 | 
            +
                        'browser.download.dir' => downloads_dir,
         | 
| 43 | 
            +
                        'browser.download.folderList' => 2,
         | 
| 44 | 
            +
                        'browser.helperApps.neverAsk.saveToDisk' => auto_download_mime_types.join(';'),
         | 
| 45 | 
            +
                        'pdfjs.disabled' => true
         | 
| 46 | 
            +
                      }
         | 
| 43 47 | 
             
                      r['general.useragent.override'] = user_agent if user_agent.present?
         | 
| 44 48 | 
             
                      r
         | 
| 45 49 | 
             
                    end
         | 
| 46 50 |  | 
| 51 | 
            +
                    def build_profile
         | 
| 52 | 
            +
                      if profile_name.present?
         | 
| 53 | 
            +
                        ::Selenium::WebDriver::Firefox::Profile.from_name(v)
         | 
| 54 | 
            +
                      elsif profile_dir.present?
         | 
| 55 | 
            +
                        ::FileUtils.mkdir_p(profile_dir)
         | 
| 56 | 
            +
                        ::Selenium::WebDriver::Firefox::Profile.new(profile_dir)
         | 
| 57 | 
            +
                      end
         | 
| 58 | 
            +
                    end
         | 
| 59 | 
            +
             | 
| 47 60 | 
             
                    def auto_download_mime_types
         | 
| 48 61 | 
             
                      ::File.read(
         | 
| 49 62 | 
             
                        ::File.join(__dir__, 'firefox_auto_download_mime_types')
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: aranha-selenium
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.2.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Esquilo Azul Company
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2021-07-24 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activesupport
         | 
| @@ -44,12 +44,27 @@ dependencies: | |
| 44 44 | 
             
                - - ">="
         | 
| 45 45 | 
             
                  - !ruby/object:Gem::Version
         | 
| 46 46 | 
             
                    version: 3.142.3
         | 
| 47 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 48 | 
            +
              name: eac_ruby_gem_support
         | 
| 49 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 50 | 
            +
                requirements:
         | 
| 51 | 
            +
                - - "~>"
         | 
| 52 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 53 | 
            +
                    version: '0.2'
         | 
| 54 | 
            +
              type: :development
         | 
| 55 | 
            +
              prerelease: false
         | 
| 56 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 57 | 
            +
                requirements:
         | 
| 58 | 
            +
                - - "~>"
         | 
| 59 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 60 | 
            +
                    version: '0.2'
         | 
| 47 61 | 
             
            description: 
         | 
| 48 62 | 
             
            email: 
         | 
| 49 63 | 
             
            executables: []
         | 
| 50 64 | 
             
            extensions: []
         | 
| 51 65 | 
             
            extra_rdoc_files: []
         | 
| 52 66 | 
             
            files:
         | 
| 67 | 
            +
            - Gemfile
         | 
| 53 68 | 
             
            - lib/aranha/selenium.rb
         | 
| 54 69 | 
             
            - lib/aranha/selenium/driver_factory.rb
         | 
| 55 70 | 
             
            - lib/aranha/selenium/driver_factory/base.rb
         | 
| @@ -76,8 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 76 91 | 
             
                - !ruby/object:Gem::Version
         | 
| 77 92 | 
             
                  version: '0'
         | 
| 78 93 | 
             
            requirements: []
         | 
| 79 | 
            -
             | 
| 80 | 
            -
            rubygems_version: 2.7.7
         | 
| 94 | 
            +
            rubygems_version: 3.1.6
         | 
| 81 95 | 
             
            signing_key: 
         | 
| 82 96 | 
             
            specification_version: 4
         | 
| 83 97 | 
             
            summary: Selenium' utilities for Ruby.
         |