Recently Microsoft Windows improved their Linux subsystem support with the release of WSL (Windows Subsystem for Linux) 2.  This update greatly improves the subsystem performance and available features. These improvements mean, amongst other things, that you can now run your Selenium based tests on the subsystem.

You may ask why on earth would you want to run Selenium based test on the WSL 2 subsystem.  There are three main answer to this question.  First, this helps assure that your tests can run cross OS.  Cross OS support means you have more options and flexibility for running your tests.  Second, the tests run much faster.  The Linux subsystem has relatively low overhead and surprisingly good performance.  And yes, I have found that tests run faster on WSL 2 than on the host Windows OS itself.  The final/real reason is because we can.

Notes*  The setup outlined in this post only works for headless versions of Chrome or Firefox. I suspect, but have not confirmed, that with extra work you may be able to run tests with running headless.

How to Set This Up for Yourself

System Setup

Windows Version

You will need the Windows 10 2004 update installed.

I also recommend installing the Windows Terminal as this will make working with your Linux distro easier long term.

Enable Subsystem Features

Using PowerShell to enable the VM and Subsystem features.

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart


Install latest Linux kernel

Download and install the latest Linux kernel.


Set WSL 2 default

Using PowerShell as admin and run the following commands:

wsl --set-default-version 2

Install and Setup Linux Distro

Go to the window store and install the latest version of Ubuntu

Make sure the distro is using WSL 2

Using PowerShell to make sure the distro is using version 2.

wsl -l -v

Distro Setup

User setup

Launch the distro.

Setup the admin user.

Install .Net Core SDK

wget -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-3.1


Install Browser


sudo apt install ./google-chrome-stable_current_amd64.deb

IDE Setup

Download and install VS Code from:

Add VS Code extensions

Add the C# and Remote WSL extensions.

Optionally you may want to install the .Net Core Test Explorer.

VS Code WSL setup

Connect to the distro

Click the remote icon in the lower left.

Select new window using distro.

Create and open work directory

Open the terminal.

Make a new working directory.

Open the working directory.

Code Setup

For this example we will be using an early release of MAQS 6  ( which supports Mac and Linux out of the box.  I have selected MAQS for this post because it creates easy/runnable tests without requiring me to write a lot of code.

Setup a MAQS project

Install the MAQS templates

dotnet new --install Magenic.Maqs.Templates

Create a new Selenium solution

Run: dotnet new Maqs.Selenium

dotnet new Maqs.Selenium

Updated the Browser setting in the appsettings.json file

Run Tests

Run your tests with the test explorer or CLI


dotnet test


Once you get over the initial hump of setting everything up, running your tests on the WSL 2 distro is very fast and easy.


Test run durations

Ubuntu Windows 10
12.0812 57.5372
11.4818 60.162
11.0410 57.0518
11.5882 60.762

Running 30 tests in parallel against headless Chrome