Class: PageObject::Platforms::SeleniumWebDriver::SurrogateSeleniumElement

Inherits:
Object
  • Object
show all
Defined in:
lib/page-object/platforms/selenium_webdriver/surrogate_selenium_element.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args) ⇒ Object

Raises:

  • (Selenium::WebDriver::Error::NoSuchElementError)


27
28
29
30
31
# File 'lib/page-object/platforms/selenium_webdriver/surrogate_selenium_element.rb', line 27

def method_missing(meth, *args)
  return @element.send(meth, *args) if @element
  $stderr.puts "You are calling #{meth} on an element that does not yet exist."
  raise Selenium::WebDriver::Error::NoSuchElementError
end

Instance Attribute Details

#identifierObject

Returns the value of attribute identifier.



5
6
7
# File 'lib/page-object/platforms/selenium_webdriver/surrogate_selenium_element.rb', line 5

def identifier
  @identifier
end

#otherObject

Returns the value of attribute other.



5
6
7
# File 'lib/page-object/platforms/selenium_webdriver/surrogate_selenium_element.rb', line 5

def other
  @other
end

#platformObject

Returns the value of attribute platform.



5
6
7
# File 'lib/page-object/platforms/selenium_webdriver/surrogate_selenium_element.rb', line 5

def platform
  @platform
end

#tagObject

Returns the value of attribute tag.



5
6
7
# File 'lib/page-object/platforms/selenium_webdriver/surrogate_selenium_element.rb', line 5

def tag
  @tag
end

#typeObject

Returns the value of attribute type.



5
6
7
# File 'lib/page-object/platforms/selenium_webdriver/surrogate_selenium_element.rb', line 5

def type
  @type
end

Instance Method Details

#displayed?Boolean

Returns:

  • (Boolean)


22
23
24
25
# File 'lib/page-object/platforms/selenium_webdriver/surrogate_selenium_element.rb', line 22

def displayed?
  attempt_to_find_element unless @element
  @element ? @element.element.displayed? : false
end

#exists?Boolean

Returns:

  • (Boolean)


7
8
9
10
# File 'lib/page-object/platforms/selenium_webdriver/surrogate_selenium_element.rb', line 7

def exists?
  attempt_to_find_element unless @element
  @element ? (not @element.element.nil?) : false
end

#nil?Boolean

Returns:

  • (Boolean)


17
18
19
20
# File 'lib/page-object/platforms/selenium_webdriver/surrogate_selenium_element.rb', line 17

def nil?
  attempt_to_find_element unless @element
  @element ? @element.element.nil? : true
end

#visible?Boolean

Returns:

  • (Boolean)


12
13
14
15
# File 'lib/page-object/platforms/selenium_webdriver/surrogate_selenium_element.rb', line 12

def visible?
  attempt_to_find_element unless @element
  @element ? @element.element.displayed? : false
end