Skip to content

Commit

Permalink
[rb] allow users to access the full script of the atom directly
Browse files Browse the repository at this point in the history
This will make it easier to pin an atom if desired
  • Loading branch information
titusfortner committed Sep 30, 2023
1 parent cdcc7a1 commit f6e5471
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions rb/lib/selenium/webdriver/atoms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,19 @@
module Selenium
module WebDriver
module Atoms
def atom_script(function_name)
format("/* #{function_name} */return (%<atom>s).apply(null, arguments)",
atom: read_atom(function_name))
end

private

def read_atom(function)
File.read(File.expand_path("../atoms/#{function}.js", __FILE__))
end

def execute_atom(function_name, *arguments)
script = format("/* #{function_name} */return (%<atom>s).apply(null, arguments)",
atom: read_atom(function_name))
execute_script(script, *arguments)
execute_script(atom_script(function_name), *arguments)
end
end # Atoms
end # WebDriver
Expand Down

0 comments on commit f6e5471

Please sign in to comment.