Class: Watir::Element

Inherits:
Object show all
Defined in:
lib/arachni/watir/element.rb

Instance Method Summary collapse

Instance Method Details

#attributesObject



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/arachni/watir/element.rb', line 23

def attributes
    browser.execute_script(
        %Q[
            var s = [];
            var attrs = arguments[0].attributes;
            for( var l = 0; l < attrs.length; ++l ) {
                s.push( attrs[l].name );
            }
            return s;
        ],
        self
    )
end

#eventsObject



16
17
18
19
20
21
# File 'lib/arachni/watir/element.rb', line 16

def events
    (browser.execute_script( 'return arguments[0]._arachni_events;', self ) || []).
        map { |event, fn| [event.to_sym, fn] } |
        (::Arachni::Browser::Javascript.events.flatten.map(&:to_s) & attributes).
            map { |event| [event.to_sym, attribute_value( event )] }
end

#opening_tagObject



12
13
14
# File 'lib/arachni/watir/element.rb', line 12

def opening_tag
    html.match( /<#{tag_name}.*?>/im )[0]
end