Module: OnlyofficeWebdriverWrapper::WebdriverStyleHelper
- Included in:
- WebDriver
- Defined in:
- lib/onlyoffice_webdriver_wrapper/webdriver/webdriver_style_helper.rb
Overview
Webdriver style helper
Instance Method Summary collapse
-
#get_style_parameter(xpath, parameter_name) ⇒ String?
Get style parameter of object.
-
#set_style_attribute(xpath, attribute, attribute_value) ⇒ String
(also: #set_style_parameter)
Set style attribute value of element.
-
#set_style_show_by_xpath(xpath, move_to_center = false) ⇒ void
Show element by changing it css style.
Instance Method Details
#get_style_parameter(xpath, parameter_name) ⇒ String?
Get style parameter of object
10 11 12 13 14 15 |
# File 'lib/onlyoffice_webdriver_wrapper/webdriver/webdriver_style_helper.rb', line 10 def get_style_parameter(xpath, parameter_name) get_attribute(xpath, 'style').split(';').each do |current_param| return /:\s(.*);?$/.match(current_param)[1] if current_param.include?(parameter_name) end nil end |
#set_style_attribute(xpath, attribute, attribute_value) ⇒ String Also known as: set_style_parameter
Set style attribute value of element
22 23 24 |
# File 'lib/onlyoffice_webdriver_wrapper/webdriver/webdriver_style_helper.rb', line 22 def set_style_attribute(xpath, attribute, attribute_value) execute_javascript("#{dom_element_by_xpath(xpath)}.style.#{attribute}=\"#{attribute_value}\"") end |
#set_style_show_by_xpath(xpath, move_to_center = false) ⇒ void
This method returns an undefined value.
Show element by changing it css style
32 33 34 35 36 37 38 |
# File 'lib/onlyoffice_webdriver_wrapper/webdriver/webdriver_style_helper.rb', line 32 def set_style_show_by_xpath(xpath, move_to_center = false) execute_javascript("#{dom_element_by_xpath(xpath)}.style.display = 'block';") return unless move_to_center execute_javascript("#{dom_element_by_xpath(xpath)}.style.left = '410px';") execute_javascript("#{dom_element_by_xpath(xpath)}.style.top = '260px';") end |