当我执行selenium web driver时,有没有办法加载自定义chrome扩展名(实际上是js文件的文件夹)?
答案 0 :(得分:3)
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)
]
}
})