Method: Webdrone::Form#find_item

Defined in:
lib/webdrone/form.rb

#find_item(key, n: 1, visible: true, scroll: false, parent: a0.conf.parent) ⇒ Object



163
164
165
166
167
168
169
170
171
172
# File 'lib/webdrone/form.rb', line 163

def find_item(key, n: 1, visible: true, scroll: false, parent: a0.conf.parent)
  @lastitem = \
    if @xpath.respond_to? :call
      @a0.find.xpath @xpath.call(key).to_s, n: n, visible: visible, scroll: scroll, parent: parent
    elsif @xpath.is_a?(String) && @xpath.include?('%s')
      @a0.find.xpath sprintf(@xpath, key), n: n, visible: visible, scroll: scroll, parent: parent
    else
      @a0.find.xpath Webdrone::XPath.field(key).to_s, n: n, visible: visible, scroll: scroll, parent: parent
    end
end