Class: Webdrone::Find

Inherits:
Object
  • Object
show all
Defined in:
lib/webdrone/find.rb,
lib/webdrone/logg.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, scroll: false, parent: nil) ⇒ Object



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

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

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



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

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

#id(text, n: 1, all: false, visible: true, scroll: false, parent: nil) ⇒ Object



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

def id(text, n: 1, all: false, visible: true, scroll: false, parent: nil)
  @a0.wait.for do
    items = (parent || @a0.driver).find_elements :id, text
    choose(items, n, all, visible, scroll)
  end
rescue => exception
  Webdrone.report_error(@a0, exception)
end


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

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

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



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

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

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



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

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

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



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

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