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.



13
14
15
# File 'lib/webdrone/find.rb', line 13

def initialize(a0)
  @a0 = a0
end

Instance Attribute Details

#a0Object (readonly)

Returns the value of attribute a0.



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

def a0
  @a0
end

Instance Method Details

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



41
42
43
44
45
# File 'lib/webdrone/find.rb', line 41

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

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



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

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 StandardError => error
  Webdrone.report_error(@a0, error)
end

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



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

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 StandardError => error
  Webdrone.report_error(@a0, error)
end


35
36
37
38
39
# File 'lib/webdrone/find.rb', line 35

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

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



47
48
49
50
51
# File 'lib/webdrone/find.rb', line 47

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

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



53
54
55
56
57
# File 'lib/webdrone/find.rb', line 53

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

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



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

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 StandardError => error
  Webdrone.report_error(@a0, error)
end