How to Use Selenium With Your Python Discord Bot

1. Select a Python Version

Within the Startup page on your panel, select your desired Python version (you must select the Docker image from Cybrancee). This must also be for a Python version that is 3.8 or later.

Cybrancee panel python versions

2. Add Selenium to ‘ADDITIONAL PYTHON PACKAGES’ Field

Add “selenium” to your Additional Python Packages field, and enable the toggle for Install Selenium.

Cybrancee panel startup screen, with fields outlined

3. Reinstall Your Server

You can Reinstall your server from the settings page in your panel.

Cybranceee panel settings screen, with reinstall option outlined

4. Selenium is Now Installed and Enabled

When you use Selenium, you will always need to include the following parameters and includes within your code:

Python
from selenium import webdriver
from selenium.webdriver.chrome.service import Service

service = Service(executable_path="./webdriver/chromedriver")

options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-gpu')
options.add_argument('--disable-extensions')
options.add_argument('--dns-prefetch-disable')

driver = webdriver.Chrome(service=service, options=options)

#EXAMPLE USAGE BELOW 
driver.get("https://cybrancee.com")
print(driver.title)

#OUTPUT:
#>> Website Hosting and Free Domain

Discord Bot Hosting

Was this article helpful?
Please Share Your Feedback
How Can We Improve This Article?
Table of Contents
Error Details*
Cancel