How Can We Help?
Print

How to Use Selenium With Your Python Discord Bot

Important! Selenium will only work from Python version 3.8 onwards.

1. 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.

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

3. Reinstall your server via the Settings page.

4. Selenium is now installed and enabled. When you use Selenium, you will need always include the following parameters and includes within your code:

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