How to use selenium with python in render?

import time
from selenium.webdriver import Keys, ActionChains
from selenium.webdriver.common.by import By
import undetected_chromedriver as uc
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.chrome.options import Options
from flask import Flask
from selenium import webdriver
app = Flask(__name__)
@app.route('/')
def scrape_example():
    options = Options()
    options.add_argument("--headless=new")
    driver = webdriver.Chrome(options=options)
    driver.get('http://www.example.com')
    button = driver.find_element(By.TAG_NAME, 'a')
    button.click()
    text = driver.find_element(By.TAG_NAME, 'p').text
    driver.quit()
    return text

this code gives me internal server error when i visit

Hi there,

You’ll need the Chrome driver installed, which is not included in our Python native environment out of the box.

You’ll have the best luck running this as a Docker container. See https://community.render.com/t/running-selenium-python/6840 for more information.

Regards,

Matt

I have never um used docker i did upload chromedriver to the repo but that was dumb ig so i dont know how to do it- is there a tutorial or smth? i looked on youtube but i couldnt find anything, sorry

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.