Class: Selenium::WebDriver::Remote::Bridge::LocatorConverter Private
- Inherits:
-
Object
- Object
- Selenium::WebDriver::Remote::Bridge::LocatorConverter
- Defined in:
- lib/selenium/webdriver/remote/bridge/locator_converter.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- ESCAPE_CSS_REGEXP =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
/(['"\\#.:;,!?+<>=~*^$|%&@`{}\-\[\]()])/
- UNICODE_CODE_POINT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
30
Instance Method Summary collapse
-
#convert(how, what) ⇒ Object
private
Converts a locator to a specification compatible one.
Instance Method Details
#convert(how, what) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Converts a locator to a specification compatible one.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/selenium/webdriver/remote/bridge/locator_converter.rb', line 34 def convert(how, what) how = SearchContext.finders[how.to_sym] || how case how when 'class name' how = 'css selector' what = ".#{escape_css(what.to_s)}" when 'id' how = 'css selector' what = "##{escape_css(what.to_s)}" when 'name' how = 'css selector' what = "*[name='#{escape_css(what.to_s)}']" end if what.is_a?(Hash) what = what.each_with_object({}) do |(h, w), hash| h, w = convert(h.to_s, w) hash[h] = w end end [how, what] end |