How can I launch Chrome with an unpacked extension?

前端 未结 7 1002
孤街浪徒
孤街浪徒 2020-12-20 12:28

I\'m using Selenium WebDriver to test a Google Chrome extension I\'m developing. I noticed that ChromeDriver can be customised to add extensions to the instance

7条回答
  •  执念已碎
    2020-12-20 13:04

    In Python3 it can be done like this:

    from selenium.webdriver import Chrome, ChromeOptions
    
    options = ChromeOptions()
    options.add_argument("load-extension=/path/to/unpacked_ext")
    
    driver = Chrome("/path/to/chromedriver", options=options)
    
    # (optional) Look at the uploaded extension
    driver.get("chrome://extensions")
    
    

提交回复
热议问题