我尝试使用Selenium和python加载2 unpack chrome扩展
我卡住了,因为下面的代码只添加了最后一个扩展名,所以添加了一个扩展名而不是两个。所以这一行只执行:
options.add_argument("load-extension=/Users/path/Downloads/python/proj/folder/ext_2_folder")
这是什么原因呢?
from selenium.webdriver.chrome.service import Service
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("load-extension=/Users/path/Downloads/python/proj/folder/ext_1_folder")
options.add_argument("load-extension=/Users/path/Downloads/python/proj/folder/ext_2_folder")
s = Service('/Users/path/Downloads/python/proj/folder/chromedriver')
driver = webdriver.Chrome(service=s, options=options)
driver.get("chrome://extensions")
你应该提供逗号分隔的路径…
chrome_options = Options()
unpacked_extension_a = ".../a"
unpacked_extension_b = ".../b"
chrome_options.add_argument("load-extension=" + unpacked_extension_a +','+ unpacked_extension_b)