Hello, I have a REPL which uses a Selenium Chrome Drive to get webpages.
They are launched by a BackgroundScheduler and the app has a Flask app to show the logs.
The problem is that it works fine at the beginning but after the Selenium request and after driver.quit(), the Flask app doesn’t respond anymore.
Is there a way to make it work ? Is there an issue with ports or conflicts between Selenium web browsing and Flask server on the same repl ?
I don’t have a public repl to show example right now but i’m trying to create one.
Did you tried to change from Flask to another server? Like Gunicorn or Waitress?
I think Flask is not ideal for what you are trying to do.
Yes Gunicorn will work perfectly
@GreetMe Thanks for your messages about Gunicorn
Do you have an example of a simple Repl using Gunicorn and Selenium at the same time ?
You can use Gunicorn to serve your Selenium script as a web application. Create a new Python file, for example, app.py, and add the following code:
from flask import Flask
app = Flask(__name__)
result = subprocess.run(['python', 'selenium_script.py'], stdout=subprocess.PIPE)
if __name__ == '__main__':
Open your terminal and navigate to the directory where app.py is located. Run the following command to start
This will start a web server that listens for incoming requests and runs your Selenium script when the root URL is accessed.
Thanks, I’ll try it
I need to change my current process to do that because I did not use a selenium script but the selenium object
You’re welcome, feel free to reach me if I can help more in the future