Try To Run Selenium on Autoscale Deployment

Question:
Using the SeleniumBase template, I created a Selenium web scraper project, but I want to deploy it (I’m using Flask to display info from the web scraper) as an autoscale deployment. When I try to deploy it, it says that Chrome is not installed. How can I modify the deployment to “install” Chrome, like @–smallguy89– did for a real Repl?

could you send the full error log?

@UMARismyname Here is the full error:

11/29/23 04:09:04 PM

File "/home/runner/0a8a0aa1-4e28-4ac3-862c-511f517fa02b/venv/lib/python3.8/site-packages/flask/app.py", line 2525, in wsgi_app

11/29/23 04:09:04 PM

response = self.full_dispatch_request()

11/29/23 04:09:04 PM

File "/home/runner/0a8a0aa1-4e28-4ac3-862c-511f517fa02b/venv/lib/python3.8/site-packages/flask/app.py", line 1822, in full_dispatch_request

11/29/23 04:09:04 PM

rv = self.handle_user_exception(e)

11/29/23 04:09:04 PM

File "/home/runner/0a8a0aa1-4e28-4ac3-862c-511f517fa02b/venv/lib/python3.8/site-packages/flask/app.py", line 1820, in full_dispatch_request

11/29/23 04:09:04 PM

rv = self.dispatch_request()

11/29/23 04:09:04 PM

File "/home/runner/0a8a0aa1-4e28-4ac3-862c-511f517fa02b/venv/lib/python3.8/site-packages/flask/app.py", line 1796, in dispatch_request

11/29/23 04:09:04 PM

return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)

11/29/23 04:09:04 PM

File "main.py", line 23, in home

11/29/23 04:09:04 PM

driver = new_driver()

11/29/23 04:09:04 PM

File "/home/runner/0a8a0aa1-4e28-4ac3-862c-511f517fa02b/seleniumhandler.py", line 11, in new_driver

11/29/23 04:09:04 PM

driver = webdriver.Chrome(options=chrome_options)

11/29/23 04:09:04 PM

File "/home/runner/0a8a0aa1-4e28-4ac3-862c-511f517fa02b/venv/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__

11/29/23 04:09:04 PM

super().__init__(

11/29/23 04:09:04 PM

File "/home/runner/0a8a0aa1-4e28-4ac3-862c-511f517fa02b/venv/lib/python3.8/site-packages/selenium/webdriver/chromium/webdriver.py", line 106, in __init__

11/29/23 04:09:04 PM

super().__init__(

11/29/23 04:09:04 PM

File "/home/runner/0a8a0aa1-4e28-4ac3-862c-511f517fa02b/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 288, in __init__

11/29/23 04:09:04 PM

self.start_session(capabilities, browser_profile)

11/29/23 04:09:04 PM

File "/home/runner/0a8a0aa1-4e28-4ac3-862c-511f517fa02b/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 381, in start_session

11/29/23 04:09:04 PM

response = self.execute(Command.NEW_SESSION, parameters)

11/29/23 04:09:04 PM

File "/home/runner/0a8a0aa1-4e28-4ac3-862c-511f517fa02b/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 444, in execute

11/29/23 04:09:04 PM

self.error_handler.check_response(response)

11/29/23 04:09:04 PM

File "/home/runner/0a8a0aa1-4e28-4ac3-862c-511f517fa02b/venv/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 249, in check_response

Hey there, I’ve spent a little bit of time investigating this today. It appears that the Selenium chrome driver doesn’t work in Replit deployments. Depending on your application, you may just be able to use beautiful soup directly, or you can consider using a different headless chromium library such as pyppeteer.

2 Likes

That is unfortunate! I’m using Selenium to scrape dynamically-loading website(s).

2 Likes

Hello,
I’m using Selenium on a repl I’m launching frequently … But after January 1st 2024, it won’t work anymore if not on a deployment. Do you plan on making VNC compatible deployments ?

1 Like

To clarify, you can run headless chrome in deployments, there is just something specific about the Selenium chrome-driver that is not working in deployments for some reason. We will look into it.

1 Like

Thank you! If you have any updates on this, could you post it here please?

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

Just replying to this closed thread to say that Selenium now works in Deployments as long as the right flags are passed to it and the packages are installed. To see an example, use this template: https://replit.com/@replit/Selenium-Flask-Example?v=1

7 Likes

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