Archive for the ‘Chrome’ Category.

How to use a extension with chrome and selenium-webdriver

Get the extension

I thought this would be the easy part. Turns out that the new chrome web store only lets you install directly to chrome.

downloader

Create And Use a profile

  • After you download your crx file put it in the same repo as your test. Next create a chrome profile and use the add_extension method.
      profile = Selenium::WebDriver::Chrome::Profile.new
      profile.add_extension(File.dirname(__FILE__) +"/chrome_extensions/adblock/AdBlock_v2.5.61.crx")
  • Now you can use the new profile to with a driver
      Selenium::WebDriver.for(:chrome,:profile => profile)

Trouble Shooting

  • be sure that your chromedriver is updated. I used 26.0.1383.0
  • chrome  26.0.1410.43
  • selenium-webdriver  2.31.0