Class: Webdrone::Wait

Inherits:
Object
  • Object
show all
Defined in:
lib/webdrone/logg.rb,
lib/webdrone/wait.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(a0) ⇒ Wait

Returns a new instance of Wait.



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

def initialize(a0)
  @a0 = a0
  @ignore = []
  @ignore << Selenium::WebDriver::Error::StaleElementReferenceError
  @ignore << Selenium::WebDriver::Error::NoSuchElementError
  @ignore << Selenium::WebDriver::Error::NoSuchFrameError
  @ignore << Selenium::WebDriver::Error::InvalidSelectorError
end

Instance Attribute Details

#a0Object (readonly)

Returns the value of attribute a0.



12
13
14
# File 'lib/webdrone/wait.rb', line 12

def a0
  @a0
end

#ignoreObject

Returns the value of attribute ignore.



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

def ignore
  @ignore
end

Instance Method Details

#for(&block) ⇒ Object



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

def for(&block)
  if @a0.conf.timeout
    Selenium::WebDriver::Wait.new(timeout: @a0.conf.timeout, ignore: @ignore).until(&block)
  else
    yield
  end
rescue StandardError => error
  Webdrone.report_error(@a0, error)
end

#time(val) ⇒ Object



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

def time(val)
  sleep val
rescue StandardError => error
  Webdrone.report_error(@a0, error)
end