简体   繁体   中英

How to load custom chrome extension using selenium web driver in ruby?

执行selenium Web驱动程序时,有什么方法可以加载自定义chrome扩展(实际上是js文件的文件夹)?

require 'selenium-webdriver'

driver = Selenium::WebDriver.for :chrome, 
  :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.chrome({
    'chromeOptions' => {
      'extensions' => [
        Base64.strict_encode64(File.open('/Users/user/Downloads/hallway_extension.crx', 'rb').read)
      ]
    }
  })

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM