Sha256: ee152dfc48cc7751c992d831f4c203e848b9f86a167cba6557acb9300537b01b

Contents?: true

Size: 1.48 KB

Versions: 5

Compression:

Stored size: 1.48 KB

Contents

=begin
    Copyright 2010-2022 Ecsypno <http://www.ecsypno.com>

    This file is part of the Arachni Framework project and is subject to
    redistribution and commercial restrictions. Please see the Arachni Framework
    web site for more information on licensing and terms of use.
=end

module Arachni
class BrowserCluster
module Jobs
class DOMExploration

# Loads a {#resource} and {Browser#trigger_event triggers} the specified
# {#event} on the given {#element element}.
#
# @author Tasos "Zapotek" Laskos <tasos.laskos@arachni-scanner.com>
class EventTrigger < DOMExploration

    require_relative 'event_trigger/result'

    # @return   [Symbol]
    #   Event to trigger on the given {#element element}.
    attr_accessor :event

    # @return   [Browser::ElementLocator]
    attr_accessor :element

    # Loads a {#resource} and {Browser#trigger_event triggers} the specified
    # {#event} on the given {#element element}.
    def run
        browser.on_new_page { |page| save_result( page: page ) }

        browser.load resource

        # We're disabling page restoration for the trigger as this is an one-time
        # job situation, the browser's state is going to be discarded at the end.
        browser.trigger_event( resource, element, event, false )
    end

    def to_s
        "#<#{self.class}:#{object_id} @resource=#{@resource} " +
            "@event=#{@event.inspect} @element=#{@element.inspect} " <<
            "time=#{@time} timed_out=#{timed_out?}>"
    end

end

end
end
end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
arachni-1.6.1.3 lib/arachni/browser_cluster/jobs/dom_exploration/event_trigger.rb
arachni-1.6.1.2 lib/arachni/browser_cluster/jobs/dom_exploration/event_trigger.rb
arachni-1.6.1.1 lib/arachni/browser_cluster/jobs/dom_exploration/event_trigger.rb
arachni-1.6.1 lib/arachni/browser_cluster/jobs/dom_exploration/event_trigger.rb
arachni-1.6.0 lib/arachni/browser_cluster/jobs/dom_exploration/event_trigger.rb