Sha256: 5142bc8da1065b4db1cc426ec9e4642cee2b67e7c771828fd2340007516e806a

Contents?: true

Size: 1.62 KB

Versions: 7

Compression:

Stored size: 1.62 KB

Contents

module JmeterPerf
  class DSL
    # DSL method synonymous with the JMeter Element CSSJqueryExtractor
    # @param params [Hash] Parameters for the CSSJqueryExtractor element (default: `{}`).
    # @yield block to attach to the CSSJqueryExtractor element
    # @return [JmeterPerf::CSSJqueryExtractor], a subclass of JmeterPerf::DSL that can be chained with other DSL methods.
    # @see https://github.com/jlurena/jmeter_perf/wiki/1.-DSL-Documentation#cssjqueryextractor
    def css_jquery_extractor(params = {}, &)
      node = CSSJqueryExtractor.new(params)
      attach_node(node, &)
    end

    class CSSJqueryExtractor
      attr_accessor :doc
      include JmeterPerf::Helpers::XmlDocumentUpdater

      def initialize(params = {})
        testname = params.is_a?(Array) ? "CSSJqueryExtractor" : (params[:name] || "CSSJqueryExtractor")
        @doc = Nokogiri::XML(JmeterPerf::Helpers::String.strip_heredoc(
          <<~EOS
            <HtmlExtractor guiclass="HtmlExtractorGui" testclass="HtmlExtractor" testname="#{testname}" enabled="true">
              <stringProp name="HtmlExtractor.refname"/>
              <stringProp name="HtmlExtractor.expr"/>
              <stringProp name="HtmlExtractor.attribute"/>
              <stringProp name="HtmlExtractor.default"/>
              <stringProp name="HtmlExtractor.match_number"/>
              <stringProp name="HtmlExtractor.extractor_impl"/>
              <boolProp name="HtmlExtractor.default_empty_value"/>
            </HtmlExtractor>
          EOS
        ))
        update params
        update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
jmeter_perf-1.1.1 lib/jmeter_perf/dsl/css_jquery_extractor.rb
jmeter_perf-1.1.0 lib/jmeter_perf/dsl/css_jquery_extractor.rb
jmeter_perf-1.0.10 lib/jmeter_perf/dsl/css_jquery_extractor.rb
jmeter_perf-1.0.9 lib/jmeter_perf/dsl/css_jquery_extractor.rb
jmeter_perf-1.0.8 lib/jmeter_perf/dsl/css_jquery_extractor.rb
jmeter_perf-1.0.7 lib/jmeter_perf/dsl/css_jquery_extractor.rb
jmeter_perf-1.0.6 lib/jmeter_perf/dsl/css_jquery_extractor.rb