As programming languages become more powerful, they become much more capable in terms of automation and the way programmers can control other programs from scripts to automate certain processes.
That said, the whole process does come with a bunch of speed bumps and issues that programmers have to deal with quite often. In this article, we’re talking about the “unknown error: Devtoolsactiveport file doesn’t exist” error, its causes and what you can do to fix the problem.
What causes this error?
The error usually only happens with Google Chrome when using a browser controller like Selenium. There isn’t a specific reason as to why this happens, but the error can be triggered by a number of actions:
- Automatically launching the browser with root privileges.
- JVM and Selenium versions aren’t compatible.
- Outdated browser version.
How to fix this?
Here are four fixes you can try out.
Launch Chrome without a sandbox
A rather easy solution for the error, if you’re using Python and Selenium, is to simply launch the browser with no sandbox and SHM usage disabled. Simply add the following arguments when declaring the browser controller.
ChromeOptions options = new ChromeOptions(); options.addArguments("--no-sandbox"); options.addArguments("--disable-dev-shm-usage");
Disable antivirus and any third-party firewalls
Another thing that should be on your diagnostics list is to temporarily disable your antivirus and check if that lets the script access other programs. If you’re using any third-party firewalls, they can also cause conflict with network communications under the pretext of keeping you safe.
Check for updates
If the issue is in Chrome itself, chances are developers might release an update to fix the problem. Regardless, you should always make sure you’ve got the latest version of the browser installed to avoid running into problems that could otherwise be avoided.
Head over to chrome://settings/help and make sure you’re on the latest update. If you’re not, update immediately and try again.
Try launching the browser again after the update and the error shouldn’t happen.
Reset your browser
Resetting Chrome can fix all sorts of random bugs and glitches with the browser.
Step 1: Head over to chrome://settings/reset. Click on Restore settings to their original defaults.
Step 2: Chrome will show you a warning prompt. Click on Reset Settings, and your browser will reset to default settings.
This should fix the issue.