Run Selenium headless browser on Railway using Python
Hey there!
I'm trying to run a Selenium instance in my Railway app, but not able to initialize the driver. Is it possible to run Selenium applications on Railway? Sorry if it's obvious!
I tried a few different things, but can't seem to be able to make the binary for the driver accessible to the application. The application runs locally but not when deployed to Railway.
1 - Using the webdriver_manager module
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
2 - Manually adding geckodriver to the package
driver = webdriver.Firefox('drivers/', options=options)
Source for Selenium portion of the code - https://github.com/pleblira/siggy_scrape_no_pyproject/blob/main/send_tweet.py
Will post the logs in the next message.
Thanks so much in advance.
GitHub
siggy_scrape_no_pyproject/send_tweet.py at main · pleblira/siggy_sc...
Contribute to pleblira/siggy_scrape_no_pyproject development by creating an account on GitHub.
9 Replies
Project ID:
N/A
db1e62dc-407c-4199-9ea5-1827759b0594
Is it possible to run Selenium applications on Railway?yes, but from what i can tell your app does, it would also be breaking tos
this https://github.com/pleblira/siggy_scrape_no_pyproject/blob/main/send_tweet.py is a big no here on railway, to comply with tos you would need to use twitters official apis
Thanks for your reply, Brody. I thought that it could be the case.
I understand this restriction is in the TOS to prevent spam bots, but a quick analysis of my code would reveal that I'm monitoring two quite small hashtags, #stackjoin and #stackjoinadd, which get less than 50 tweets a day. Do you think I could make the case for keeping the application on? Thanks so much
(Especially because to monitor a hashtag on Twitter now it costs you $5k/mo)
I'm just a helper so I'm not able to stop you, you can do what you want, it was just a warning. but I'm also not willing to help you break tos. have a nice day!
For sure! Appreciate the help