Class: Selenium::WebDriver::Driver

Inherits:
Object
  • Object
show all
Defined in:
lib/fe_core_ext/gem_ext/selenium_webdriver.rb

Instance Method Summary collapse

Instance Method Details

#at_xpath(path, wait: nil) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/fe_core_ext/gem_ext/selenium_webdriver.rb', line 14

def at_xpath(path, wait: nil)
  if wait.present?
    driver_wait = Selenium::WebDriver::Wait.new(timeout: wait)
    driver_wait.until { fe_find_element(:xpath, path) }
  end
  fe_find_element(:xpath, path)
end

#fe_find_element(*args) ⇒ Object



2
3
4
5
6
# File 'lib/fe_core_ext/gem_ext/selenium_webdriver.rb', line 2

def fe_find_element(*args)
  find_element(*args)
rescue Selenium::WebDriver::Error::NoSuchElementError
  nil
end

#fe_find_elements(*args) ⇒ Object



8
9
10
11
12
# File 'lib/fe_core_ext/gem_ext/selenium_webdriver.rb', line 8

def fe_find_elements(*args)
  find_elements(*args)
rescue Selenium::WebDriver::Error::NoSuchElementError
  nil
end

#xpath(path, wait: nil) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/fe_core_ext/gem_ext/selenium_webdriver.rb', line 22

def xpath(path, wait: nil)
  if wait.present?
    driver_wait = Selenium::WebDriver::Wait.new(timeout: wait)
    driver_wait.until { fe_find_elements(:xpath, path) }
  end
  fe_find_elements(:xpath, path)
end