In this blog we are going to set up the integration between SAP Cloud ALM and a local Selenium WebDriver.
A Selenium Web Driver is basically a server in charge of executing so called Selenium scripts.
This constellation will be used in the setup of Synthetic User Monitoring in SAP Cloud ALM
In Synthetic User Monitoring you need a so called "Runner" which, in simple terms, is a robot that executes your prepared selenium scripts.
These runners are based on the Selenium WebDriver infrastructure.
So you will need such a web driver infrastructure and for that you have two options:
1. A cloud based 3rd party WebDriver provider.
2. A local on-premise Selenium WebDriver
If you are interested in using third party Selenium providers you can read my previous article
The application to be monitored is shown as a local web application, but it could really be any web application including cloud based ones such as SAP BTP.
The advantage of using a local Selenium WebDriver is that you can monitor on-prem web applications as well as cloud based web applications.
In this guide we will focus on the local Selenium WebDriver, depicted in the lower half of this picture.
In order to follow this setup you need the following things:
There are other options than Java or Docker for running Selenium WebDrivers, but in this tutorial I'm just going to stick with those two.
Get the latest Selenium WebDriver for Java from the official download site:
https://www.selenium.dev/downloads/
Go down to the section called "Selenium Server (Grid)", from there download the server jar file
For example: selenium-server-4.20.0.jar
Copy the jar file to a directory of your choice, then run the following command.
Unix/Linux:
java -jar .\selenium-server-4.20.0.jar standalone --selenium-manager true &
Windows (Powershell):
Start-Process -NoNewWindow java "-jar .\selenium-server-4.20.0.jar standalone --selenium-manager true"
For more commandline options including starting the server with a different port or with SSL you can refer to this site:
https://www.selenium.dev/documentation/grid/configuration/cli_options/
If you did it right, you should be able to call the url: http://localhost:4444 and see something like this:
For more information on the Selenium Docker Image you can refer to the folowing resopurces:
https://hub.docker.com/r/selenium/standalone-chrome
https://github.com/SeleniumHQ/docker-selenium
For this option you need Docker installed on your Linux server or Docker Desktop on your Windows server.
In order to optain the Docker image file execute the following command on cour commandline:
docker run -d -p 4444:4444 -p 7900:7900 --shm-size="2g" selenium/standalone-chrome:latest
This will automatically download the Docker image file from the Docker Hub repository and start a local container.
Note: You only need the docker run command the first time. Do not use the docker run command every time for starting as it will always create a new container.
Instead use the docker ps command and docker start command:
docker ps -a
This will give you the container id:
Then use this id to start the container again:
docker start <containerid>
Again if you did everything right, you should see this from the local url http://localhost:4444
Notice that in this case there's only one browser available, depending on the docker image you chose.
As mentionned before, in order to connect SAP Cloud ALM to your local Selenium WebDriver you must have registered the SAP Cloud Connector in the subaccount or your SAP Cloud ALM.
Once SAP Cloud Connector is available in the Subaccount you have to expose the local server and port to it.
Log on to your SAP Cloud Connector, then choose the subaccount.
Then from the lefthand menu choose "Cloud to on Premise" and click on th + button.
Choose "Non-SAP System" and click Next
Choose the protocoll that your Selenium serve is running on and click Next
Enter the fqdn or ip of your local selenium server and the port
Note: If there's a firewall between yout SAP Cloud Connector and your local server, then you obviously have to allow traffic with that port to it.
Then indicate the virtual host name and port as you want it to be available later on in Synthetic User Monitoring
If you want users authenticated on your BTP to be propagated to your local server then enable this.
Note: This really only makes sense when you are running your Selenium WebDriver asking for user/password and the user is the same as you log on to your BTP (Cloud ALM).
Now add a path to the newly registered virtual server
In this example I chose "/" and all sub paths, please make sure you consider your own safety requirements.
Once the path is registered the status of the virtual host will become green.
The result in your SAp Cloud ALM subaccount should look like this:
The setup in of Synthetic user monitoring is pretty much the same as in my previous article on Setting up Synthetic User Monitoring , so I'm not going to repeat everything here.
However there's one major difference and that is, now you have to register a local runner.
From the main page choose "Operations" then "Synthetic User Monitoring":
From the SUM main page click on the setting button:
From the righthand side menu expand "Runners" the click on the edit button:
Click on the "Add" button
On the next screen enter a name, the type "On Premise" and the virtual host that we registered using SAP Cloud Connector.
Note: If you set up your local Selenium WebDriver without username/password you can just enter "None" and any bogus password.
Result, the Runner status should become green like this:
Now it is ready to use in the scenarios for further setup.
We have learner how to install a local Selenium Server, so called WebDriver.
Then we have set up SAP Cloud Connector to give us a virtual hostname pointing to our local server.
Finally we have registered a runner pointing to our local Selenium Server through SAP Cloud Connector.
I hope you find my article usefull. I would be happy if you would share your thoughts and I'm happy to assist with any questions to my best abilities.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 | |
2 |