Search code examples
pythonseleniumpythonanywhere

How can I use Firefox webdriver in pythonanywhere.com


I can use Chromedriver easyly in pythonanywhere.com but how can I use Firefox driver in pythonanywhere's python script ?

this is how I use chromedriver

from selenium import webdriver

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
browser = webdriver.Chrome(options=chrome_options)

browser.get("https://www.youtube.com/")
print("Done")
browser.quit()

Solution

  • PythonAnywhere dev here: unfortunately Firefox doesn't work well enough to be fully supported on PythonAnywhere now -- it's too resource-intensive. Chrome is more lightweight, so it's the only Selenium option we support.

    (Interestingly, it used to be the other way around -- Firefox was more lightweight, and was the one that we supported. But the browsers have changed over time, so we have to change with them.)