0
votes

I have successfully set app chromedriver with the following set up on Heroku.

I would like to add some extensions (myextension.crx) through the webdriver options.

Can you help? (what path to use and how to steps please)

I.e

options = webdriver.ChromeOptions()
options.add_extension('./myextension.crx')

#Heroku Chromedriver Set Up
from selenium import webdriver
from selenium.webdriver.chrome.options import Options


CHROMEDRIVER_PATH = "/app/.chromedriver/bin/chromedriver"
chrome_bin =os.environ.get('GOOGLE_CHROME_SHIM', None)
options = webdriver.ChromeOptions()
options.binary_location = chrome_bin
options.add_argument(" — disable-gpu")
options.add_argument(" — no-sandbox")
options.add_argument(" — headless")
options.add_argument('--disable-dev-shm-usage') 
options.add_argument('--remote-debugging-port=9222')
options.add_argument('--disable-infobars')

driver = webdriver.Chrome(executable_path="chromedriver", chrome_options=options)

Also used the official buildpacks

https://github.com/heroku/heroku-buildpack-google-chrome

https://github.com/heroku/heroku-buildpack-chromedriver

And Variables

CHROMEDRIVER_PATH = /app/.chromedriver/bin/chromedriver

GOOGLE_CHROME_BIN = /app/.apt/usr/bin/google-chrome

1

1 Answers

0
votes

I don't think you can run extensions on Chrome Driver in headless mode. Switching to Firefox with geckodriver is one potential solution though