Class: Webdrone::Find

Inherits:
Object
  • Object
show all
Defined in:
lib/webdrone/find.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(a0) ⇒ Find

Returns a new instance of Find.



11
12
13
# File 'lib/webdrone/find.rb', line 11

def initialize(a0)
  @a0 = a0
end

Instance Attribute Details

#a0Object

Returns the value of attribute a0.



9
10
11
# File 'lib/webdrone/find.rb', line 9

def a0
  @a0
end

Instance Method Details

#button(text, n: 1, all: false, visible: true) ⇒ Object



38
39
40
41
42
# File 'lib/webdrone/find.rb', line 38

def button(text, n: 1, all: false, visible: true)
  self.xpath XPath::HTML.button(text).to_s, n: n, all: all, visible: visible
rescue => exception
  Webdrone.report_error(@a0, exception, Kernel.caller_locations)
end

#css(text, n: 1, all: false, visible: true) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/webdrone/find.rb', line 23

def css(text, n: 1, all: false, visible: true)
  @a0.wait.for do
    items = @a0.driver.find_elements :css, text
    choose(items, n, all, visible)
  end
rescue => exception
  Webdrone.report_error(@a0, exception, Kernel.caller_locations)
end

#id(text) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/webdrone/find.rb', line 15

def id(text)
  @a0.wait.for do
    @a0.driver.find_element :id, text
  end
rescue => exception
  Webdrone.report_error(@a0, exception, Kernel.caller_locations)
end


32
33
34
35
36
# File 'lib/webdrone/find.rb', line 32

def link(text, n: 1, all: false, visible: true)
  self.xpath XPath::HTML.link(text).to_s, n: n, all: all, visible: visible
rescue => exception
  Webdrone.report_error(@a0, exception, Kernel.caller_locations)
end

#on(text, n: 1, all: false, visible: true) ⇒ Object



44
45
46
47
48
# File 'lib/webdrone/find.rb', line 44

def on(text, n: 1, all: false, visible: true)
  self.xpath XPath::HTML.link_or_button(text).to_s, n: n, all: all, visible: visible
rescue => exception
  Webdrone.report_error(@a0, exception, Kernel.caller_locations)
end

#option(text, n: 1, all: false, visible: true) ⇒ Object



50
51
52
53
54
# File 'lib/webdrone/find.rb', line 50

def option(text, n: 1, all: false, visible: true)
  self.xpath XPath::HTML.option(text).to_s, n: n, all: all, visible: visible
rescue => exception
  Webdrone.report_error(@a0, exception, Kernel.caller_locations)
end

#xpath(text, n: 1, all: false, visible: true) ⇒ Object



56
57
58
59
60
61
62
63
# File 'lib/webdrone/find.rb', line 56

def xpath(text, n: 1, all: false, visible: true)
  @a0.wait.for do
    items = @a0.driver.find_elements :xpath, text
    choose(items, n, all, visible)
  end
rescue => exception
  Webdrone.report_error(@a0, exception, Kernel.caller_locations)
end