Method: Selenium::WebDriver::Chrome::Options#add_extension

Defined in:
lib/selenium/webdriver/chrome/options.rb

#add_extension(path) ⇒ Object

Add an extension by local path.

Examples:

options = Selenium::WebDriver::Chrome::Options.new
options.add_extension('/path/to/extension.crx')

Parameters:

  • path (String)

    The local path to the .crx file

Raises:



63
64
65
66
67
# File 'lib/selenium/webdriver/chrome/options.rb', line 63

def add_extension(path)
  raise Error::WebDriverError, "could not find extension at #{path.inspect}" unless File.file?(path)
  raise Error::WebDriverError, "file was not an extension #{path.inspect}" unless File.extname(path) == '.crx'
  @extensions << path
end