

We’ll need to install a couple things: Selenium, which allows you to control browsers from Python. Can we write ChromeDriver driver new ChromeDriver ()?ĭo we need to install ChromeDriver for selenium?.

How do I install Google Chrome on my PC?.How do you download Google Chrome for Windows?.Can we write Chromedriver driver new Chromedriver ()?.Do we need to install ChromeDriver for selenium?.CHROMEDRIVER_PATH = /app/.chromedriver/bin/chromedriver.Here, we will add the paths to Chrome and the Chromedriver. Python (Select it from the officially supported buildpacks).Click on the Settings tab and scroll down to Buildpacks. # Now you can start using Selenium Step 2: Add the Buildpacks from selenium import webdriverĬhrome_options = webdriver.ChromeOptions()Ĭhrome_options.binary_location = os.environ.get("GOOGLE_CHROME_BIN")Ĭhrome_options.add_argument("-headless")Ĭhrome_options.add_argument("-disable-dev-shm-usage")Ĭhrome_options.add_argument("-no-sandbox")ĭriver = webdriver.Chrome(executable_path=os.environ.get("CHROMEDRIVER_PATH"), chrome_options=chrome_options) Step 1: Set Up Your CodeĪdd the following lines to your code before you use Selenium.

Several people have commented that this method fixed their problems, so I’ll post a text version of this tutorial as well.

I wasn’t able to find any information about this issue readily available online, so when I finally solved the issue, I went ahead and created the above video tutorial. The problem here was that my code for Selenium refused to execute on Heroku. Selenium is a Python library that can be used to “drive” web browsers such as Chrome, Firefox, etc so you can access websites, perform web scraping, and build tools to test your web apps. I have recently been experimenting with the Heroku platform for building basic web apps, and my experience has been nothing but excellent so far.Īt least, that was until I tried to incorporate Selenium into one of my Python projects.
