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

#a0 ⇒ Object

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



25
26
27
# File 'lib/webdrone/find.rb', line 25

def button(text, n: 1, all: false, visible: true)
  self.xpath XPath::HTML.button(text).to_s, n: n, all: all, visible: visible
end

#id(id) ⇒ Object



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

def id(id)
  @a0.wait.for do
    @a0.driver.find_element :id, id
  end
end


21
22
23
# File 'lib/webdrone/find.rb', line 21

def link(text, n: 1, all: false, visible: true)
  self.xpath XPath::HTML.link(text).to_s, n: n, all: all, visible: visible
end

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



29
30
31
# File 'lib/webdrone/find.rb', line 29

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
end

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



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

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
end