Services and scripts
How to run Selenium on a server without your own computer
In short
Selenium runs on a server like any other background script, with one catch: an automatic build installs your language and libraries, but not a browser. So this kind of project needs its own Dockerfile, a plain text recipe file next to your code that says to install Chromium, and the browser itself has to run headless, without a window, because a server has no screen. With Netrun you put that Dockerfile in the project folder and upload it: the platform builds the project from your recipe and keeps the script running without your computer.
A Selenium script usually starts life on your own laptop: the browser opens, clicks around and collects data. The trouble begins when the collection has to keep going on its own. You close the lid or leave the house, and everything stops. The classic fix is to rent a server, install Chrome and a driver on it, work out why the browser refuses to start without a desktop, add fonts, set the script to launch on boot, and keep an eye on it so it does not die quietly. That is where the question comes up: how do you run Selenium on a server without becoming a server admin.
With Netrun you upload a folder of code, and the platform builds the project, runs it on our servers and shows the logs in your dashboard. One honest caveat, and it is the only technical thing you have to learn here: the browser is not part of the automatic build, so you add your own Dockerfile next to the code to install it. That is a single short setup step; everything after it is ordinary. Below is how to do it and what else to check so the script keeps working without you.
Check whether you need Selenium at all#
For roughly half of scraping tasks a browser is unnecessary. Open the page you need and look at its source: if the data is already there, a plain request with requests or httpx plus an HTML parser is enough. That kind of scraper is simpler to run, many times faster and far lighter on resources. Selenium earns its place when the content is drawn by scripts inside the browser, when you have to log in by clicking through a form, or when the page comes back empty without a real browser.
Add a Dockerfile that installs the browser#
An automatic build installs Python and the libraries from requirements.txt, but there is no browser in it, which is why Selenium on a server usually complains that it cannot find Chrome. The fix is your own Dockerfile: a plain text file named Dockerfile in the project root that lists, line by line, which image to start from, what to install and how to start the app. If that file sits next to your code, Netrun builds the project from it instead of using the automatic recipe. The easiest route is a ready image that already ships Chromium and the driver, or a line that installs the chromium and chromium-driver packages.
Start the browser headless with the right flags#
A server has no screen, so the browser has to run headless, without a window. In Selenium that is the --headless flag, and inside a container you normally add --no-sandbox and --disable-dev-shm-usage as well, otherwise the browser starts and dies immediately. It also helps to set --window-size, or the site decides it is dealing with a tiny screen and serves a different layout. And close the browser when the job is done: forgotten instances eat memory faster than you expect.
Move logins and keys into secrets#
If the script signs into an account, calls a paid API or pushes results to another service, keep passwords and tokens out of the code. Read them from environment variables: during project setup Netrun asks for the values and passes them in encrypted. They never sit in the archive or in your GitHub repository, and you can change a value in your dashboard without touching the code.
Write results into the persistent /data folder#
Files written next to the code are recreated on the next publish, so save tables, exports and screenshots into the /data folder instead: its contents survive both code updates and restarts. Your dashboard has a Data tab that lists the files so you can download, upload or delete them without setting anything up. If there is a lot of data and you need to query it, put a SQLite file in the same folder or connect an external database: the platform has no managed database as a separate service.
Upload the project and watch the first run in the logs#
Bring the folder in as a ZIP archive or import a GitHub repository, private ones included. Netrun picks up your Dockerfile, builds the project from it and starts the script; logs and build status are visible in your dashboard in real time, so the first browser error shows up straight away. Worth knowing up front: a browser is much heavier than a plain script and needs noticeably more memory, so on the free plan it may not fit and will crash on startup. Current prices and limits are shown in your dashboard.
The result is a scraper that runs on our servers and no longer depends on whether your computer is switched on: if it fails, the project is restarted and you get a notification. One thing to know about the free plan up front: a background script never sleeps, because nothing would wake it, so it runs free for 3 days and then the project is switched off. The code, settings and secrets stay in place, and a warning arrives a day before the shutdown. If the collection has to run continuously, the Pro plan is what you need. Try Netrun.
Common questions
Why does Selenium say it cannot find Chrome or chromedriver?
Because there really is no browser in the container: an automatic build installs the language and the libraries, but not a browser. Add a Dockerfile to the project root that installs Chromium together with the driver and publish again, and the platform will build the project from your file.
Does the browser have to run in headless mode?
Yes. A server has no screen, so the usual windowed mode simply will not start. Add the --headless flag, and alongside it --no-sandbox and --disable-dev-shm-usage: inside a container the browser often crashes right after launch without them.
Can I run Playwright instead of Selenium?
Yes, and the rule is the same: Playwright also needs a browser, which the automatic build does not provide. Write a Dockerfile based on the official Playwright image with browsers already installed, or add the browser install command to it. After that the project is published like any other.
How do I run a Selenium script on a schedule, say once an hour?
Netrun has no separate scheduler, so the schedule lives inside the script itself: an endless loop with a pause, or a library such as schedule or APScheduler. The project then behaves as a permanently running background script that decides for itself when to wake up and open the browser.
Is the free plan enough to run a browser?
Not always: a browser is much hungrier than a plain script, and on the free plan it may run out of memory, which usually looks like a crash right after startup. Being frugal helps, such as closing the browser after every task and not keeping many tabs open, and so does moving to Pro. Current prices and limits are shown in your dashboard.
Where should I store the collected data and screenshots?
In the persistent /data folder: anything written there survives code updates and restarts. You can pick the files up from the Data tab in your dashboard, one by one or as a folder. Files written next to the code are recreated from scratch on the next publish.
Can I run a Python project — Django, Flask or FastAPI?
Yes. Put your dependencies in requirements.txt — Netrun detects Python and builds the project for you. Django, Flask and FastAPI are supported; the app should listen on the port from the environment variable, and keys and database access are set as secrets rather than in the code.
Where do I set tokens and other secret values?
Every project has a Secrets tab where you set the values from your code — for example the token from BotFather. We store them encrypted: you can see the variable names, but the values are shown to no one, including you.
Do bots and background scripts sleep?
No, only websites sleep: a website wakes up by itself when someone opens it. A bot or a background script has nothing to wake it — nobody comes to them by link, they work on their own. That is why on the free plan they run for 3 days, and after that a bot needs the Pro plan to keep running around the clock.
What happens if my app crashes?
We watch over projects and restart them if they fail. If something goes wrong, you can see the status and logs in your account and you get a notification.