Skip to content

Instantly share code, notes, and snippets.

@kargaranamir
Last active August 25, 2023 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kargaranamir/c5bfc8307ed178a364a080c8a554f1f9 to your computer and use it in GitHub Desktop.
Save kargaranamir/c5bfc8307ed178a364a080c8a554f1f9 to your computer and use it in GitHub Desktop.
install selenium in gradio

Create a file named packages.txt in the root directory of Gradio, and insert the following content:

chromium-driver

By doing this, you will ensure the installation of the Chromium driver for Debian.

create a a file named requirements.txt in the root directory of Gradio, and insert the following content:

selenium >=4.0.0, < 5.0.0

By doing this, you will ensure the installation of selenium.

now you can in the app.py import selenium

from selenium import webdriver
from selenium.common.exceptions import WebDriverException

I provided an example here, this space can get screenshot of the input url: https://huggingface.co/spaces/kargaranamir/selenium-screenshot-gradio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment