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



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

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

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



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

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
end

#id(text) ⇒ Object



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

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


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

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



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

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

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



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

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

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



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

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