Module: SeleniumPlus::Finders

Included in:
Selenium::WebDriver::Element, Driver, Iframe, Page, Section
Defined in:
lib/selenium_plus/finders.rb

Instance Method Summary collapse

Instance Method Details

#find(*args) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/selenium_plus/finders.rb', line 3

def find(*args)
  if self.class == Selenium::WebDriver::Element
    @el = self.find_element(*args)
  elsif self.class.superclass == SeleniumPlus::Section
    @el = root_element.find_element(*args)
  else
    @el = SeleniumPlus.driver.native.find_element(*args)
  end
  SeleniumPlus.driver.highlight_element(@el) if SeleniumPlus.enable_highlight_element
  @el
end

#find_all(*args) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/selenium_plus/finders.rb', line 15

def find_all(*args)
  if self.class == Selenium::WebDriver::Element
    self.find_elements(*args)
  elsif self.class.superclass == SeleniumPlus::Section
    root_element.find_elements(*args)
  else
    SeleniumPlus.driver.native.find_elements(*args)
  end
end