123456789_123456789_123456789_123456789_123456789_

Module: Selenium::WebDriver::Atoms

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: rb/lib/selenium/webdriver/atoms.rb

Instance Method Summary

Instance Method Details

#atom_script(function_name)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/atoms.rb', line 23

def atom_script(function_name)
  format("/* #{function_name} */return (%<atom>s).apply(null, arguments)",
         atom: read_atom(function_name))
end

#execute_atom(function_name) (private)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/atoms.rb', line 37

def execute_atom(function_name, *)
  execute_script(atom_script(function_name), *)
end

#read_atom(function) (private)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/atoms.rb', line 30

def read_atom(function)
  file = "selenium/webdriver/atoms/#{function}.js"
  lib = File.expand_path('../..', __dir__.to_s)
  dir = [lib, *$LOAD_PATH].find { |path| File.exist?(File.expand_path(file, path)) }
  File.read(File.expand_path(file, dir || lib))
end