Class: Citronella::Ui::WebUi
- Inherits:
-
Object
- Object
- Citronella::Ui::WebUi
- Defined in:
- lib/web_ui.rb
Instance Method Summary collapse
-
#click ⇒ Object
Clicks on the web element.
-
#get_element ⇒ Webdriver::Element
Returns a web element using find_element method.
-
#get_elements ⇒ Array<Webdriver::Element>
Returns a list of web elements using find_elements method.
-
#initialize(driver, webdriver_wait, logger, locator, function_name, class_name) ⇒ WebUi
constructor
A new instance of WebUi.
-
#send_keys(text, clear = false, return_key = false) ⇒ Object
Sends keys to the web element.
Constructor Details
#initialize(driver, webdriver_wait, logger, locator, function_name, class_name) ⇒ WebUi
Returns a new instance of WebUi.
37 38 39 40 41 42 43 44 45 |
# File 'lib/web_ui.rb', line 37 def initialize(driver, webdriver_wait, logger, locator, function_name, class_name) @driver = driver @wait = webdriver_wait @logger = logger @locator = locator @function_name = function_name @class_name = class_name end |
Instance Method Details
#click ⇒ Object
Clicks on the web element.
82 83 84 85 86 |
# File 'lib/web_ui.rb', line 82 def click Citronella::Log.logger(@logger, @class_name, @function_name, __method__) el = webdriver_wait(@driver.find_element(@locator), displayed=true) el.click end |
#get_element ⇒ Webdriver::Element
Returns a web element using find_element method.
92 93 94 95 96 |
# File 'lib/web_ui.rb', line 92 def get_element Citronella::Log.logger(@logger, @class_name, @function_name, __method__.to_s) webdriver_wait(@driver.find_element(@locator)) end |
#get_elements ⇒ Array<Webdriver::Element>
Returns a list of web elements using find_elements method.
102 103 104 105 106 |
# File 'lib/web_ui.rb', line 102 def get_elements Citronella::Log.logger(@logger, @class_name, @function_name, __method__.to_s) webdriver_wait(@driver.find_elements(@locator)) end |
#send_keys(text, clear = false, return_key = false) ⇒ Object
Sends keys to the web element.
70 71 72 73 74 75 76 77 78 |
# File 'lib/web_ui.rb', line 70 def send_keys(text, clear=false, return_key=false) Citronella::Log.logger(@logger, @class_name, @function_name, __method__) el = webdriver_wait(@driver.find_element(@locator), displayed=true) el.send_keys text if return_key el.send_keys :return end end |