Prerequisites to run Synthetic Monitoring scripts
This topic outlines the software installations and configurations required to run the Synthetic Monitoring scripts by using the Selenium and Playwright frameworks on both Windows and Linux environment.
Windows environment
This section provides information about how to install and use the Selenium and Playwright frameworks in a Windows environment.
To use the Playwright framework for Chrome and Edge browsers
- Note the browser version by performing the following steps (applicable to the Chrome or Edge browser):
- Navigate to Settings.
- Click About.
For example, the browser version can be 140.0.7339.210 (Official Build) (64-bit).
- Download the driver that matches your installed browser version:
- Add the full path of the browser driver executable to your system’s environment variables.
For example, C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\chromedriver.exe or C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\msedgedriver.exe. - Install Python 3.10 or above from https://www.python.org/downloads/ and add the Python installation directory to your system’s environment variables.
- Open the command prompt and run the following commands to install Playwright:
pip install playwright
playwright install - Run a sample Playwright Python script by using the Chrome or Edge browser to verify that the environment is correctly configured.
To use the Selenium framework for Chrome and Edge browsers
- Note the browser version by performing the following steps (applicable to the Chrome or Edge browser):
- Navigate to Settings.
- Click About.
For example, the browser version can be 140.0.7339.210 (Official Build) (64-bit).
- Download the driver that matches your installed browser version:
- Add the full path of the browser driver executable to your system’s environment variables.
For example, C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\chromedriver.exe or C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\msedgedriver.exe. - Install Python 3.10 or above from https://www.python.org/downloads/ and add the Python installation directory to your system’s environment variables.
- Open a command prompt and run pip install selenium to install Selenium.
- Run a sample Selenium Python script by using the Chrome or Edge browser to verify that the environment is correctly configured.
Linux environment
This section provides information about how to install and use the Selenium and Playwright frameworks in a Linux environment.
To use the Playwright framework for Chrome and Edge browsers
- Install the required browsers by using the following commands:
- For Chrome, by using DNF:
dnf install -y https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm google-chrome –-version - For Edge:
Add Microsoft Edge Dev Repository- tee /etc/yum.repos.d/microsoft-edge-dev.repo > /dev/null <<EOF
[microsoft-edge-dev]
name=Microsoft Edge Dev Channel
baseurl=https://packages.microsoft.com/yumrepos/edge
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc
EOFInstall Edge Browser-
dnf install -y microsoft-edge-dev microsoft-edge-dev --version
- For Chrome, by using DNF:
- Install the required driver that matches your installed browser version by using the following commands:
- For Chrome: wget https://storage.googleapis.com/chrome-for-testing-public/<version>/<platform>/chromedriver-<platform>.zip
- For Edge: wget https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver/<version>/edgedriver_<platform>.zip
- Install Python version 3.10 or above.
- Run the following commands to install Playwright:
pip install playwright
playwright install Run a sample Playwright Python script by using the Chrome or Edge browser to verify that the environment is correctly configured.
To use the Selenium framework for Chrome and Edge browsers
- Install the required browsers by using the following commands:
- For Chrome, by using DNF:
dnf install -y https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm google-chrome –-version - For Edge:
Add Microsoft Edge Dev Repository- tee /etc/yum.repos.d/microsoft-edge-dev.repo > /dev/null <<EOF
[microsoft-edge-dev]
name=Microsoft Edge Dev Channel
baseurl=https://packages.microsoft.com/yumrepos/edge
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc
EOFInstall Edge Browser-
dnf install -y microsoft-edge-dev microsoft-edge-dev --version
- For Chrome, by using DNF:
- Install the required driver that matches your installed browser version by using the following commands:
- For Chrome: wget https://storage.googleapis.com/chrome-for-testing-public/<version>/<platform>/chromedriver-<platform>.zip
- For Edge: wget https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver/<version>/edgedriver_<platform>.zip
- Install Python version 3.10 or above.
- Run the following command to install Selenium:
pip install selenium
5. Run a sample Selenium Python script by using the Chrome or Edge browser to verify that the environment is correctly configured.