Selenium Grid Video Recording - Record Test execution on docker container | Selenium Grid 4 features

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys uh welcome to the next session in selenium grid docker series so previously we have seen how we can set up the selenium grid in the docker and how we can run our selenium test cases from local machine or in the aws ecu instance as well okay so now uh we are going to see how we can record the test execution which is happening in the docker container okay that means if you are running your uh test cases selenium test cases on the docker on the chrome browser or firefox or edge browser so i need to record that a test execution so that it will help me to debug any issues okay related to the application so normally we run our uh test automation in the night only right so when we are in the office we will get the test case execution report okay automation report so in in night we cannot do the live monitoring for each and every test cases right so if any test case is failing and if we turn on the video recording for the test case then we can easily able to see what exactly happening uh while watching that recorded video right so this will definitely help you in your real-time project as well so what we have to do is uh you need to follow these simple steps you need to create a docker compose ml file and we need to add the required services okay so we have already created the docker compose ml file in previous sessions so same we will see how we can use it and we need to set up this docker selenium grid with a docker compose file okay then we will run our selenium test cases and once our test case execution is done we will get the recorded video on our local machine okay so let's start now so this is the docker compose vmware file we are going to use for this demonstration so here i added two service one is for our selenium hub service okay this is the hub service and another one is for chrome service okay so i will show you how you can record the test execution happening on the chrome browser and same step we need to follow for uh recording the video on the edge browser or firefox browser okay you just need to uh add those services in this docker compose ml file okay so in hub service what we have uh for creating the container for our hub service i have written that use this image okay so on local machine if this image is not available it will go to the docker hub and it will pull that image and it will create container out of it okay so these are the ports we are exposing so our selenium grid the selenium hub will run on this 4445 okay so you will be able to access that service from this local machine 4445 port okay then we had the chrome service for creating our chrome node container okay so both these services will be created these two containers will be available in the same network okay same docker network so that they can communicate so for creating the chrome node this is the image that it is going to use okay this is the latest chrome service or chrome node image available on the docker hub and these are the ports we are exposing okay so five nine double zero and seven nine double zero vnc and no nc ports and these are the environment setting you need to add here okay so this chrome services depend upon the hub service okay this hub service so for recording the video on the chrome you just need to add this service so for this service this is the service name chrome underscore video and this is the image it is going to use selenium video ffmp easy okay this is the latest image for the service okay and these are the volumes okay so here we will get the video in this uh folder only okay dot slash test recordings so this folder will be created in our local machine where your docker compose ml file is available okay so there it will create this folder automatically and whatever video recording you will get at the end of test education that will be available in this folder in the dot mp4 format okay so this service it depends upon the chrome service right and these are the environments so our display container name is chrome service okay so this is this is for chrome so we need to record the video what is test execution happening on the chrome browser so you need to provide the chrome service here and this is the file name so you can give any file name here okay test on chrome video one dot mp4 so this will be the file name after uh text execution is done okay so this is done for the chrome browser so if you want to record the video on the edge browser or firefox you can so you need to follow the same approach you just need to add the service firefox service and then edge video and firefox video okay in similar fashion so now uh let's go and create and run this services okay uh by running this docker compose normal file okay so just go to the location where uh this docker compose jammel file is available so this is the location so from here i will open my powershell so before running our docker compose vml file you need to start the docker desktop application on the windows machine so i have started this docker desktop application so docker engine is up and running now so to run the docker compose ml file you just need to use this command docker compose space iphone f and just provide the docker compass file name dot yml and up and hyphen d okay so first it will pull all the images first okay so currently all these images for hub service chrome service and this chrome video service are already available on my local machine okay so in your case it will go to the docker hub and pull all these images okay all these are the latest images okay so it will take some time in your case and when all the images are downloaded then it will create the container out of it and it will start all those containers okay so if you see all the running containers now so these are the containers these are the images out of which these containers are created okay so here you will see different ports that are exposed okay so we can access vnc and no nc service from this ports using this port number okay so let's see first our hub that will be accessible on our local machine so just type 127.0.1 colon 4445 okay so this is our selenium grid up and running and here you can see one chrome node is connected so if you added the service and firefox service those nodes will also be shown here okay so now let's go and run any one selenium test case on this chrome node and we will see how we can record the video now so this is the project we are going to use so same project we have used in our whole playlist right so here what we are going to do is we are sending the browser parameter from the test ngxml file for our test case okay so depending upon the browser parameter we are going to set the capabilities for the browser type okay so if it is chrome then we are going to open the chrome and our test case execution will start on the chrome okay if it is firefox then it will open the firefox then if it is age then it will set up the browser capabilities to the edge okay so once it is done we need to set driver is equal to new remote web driver and here i need to provide the ip okay so currently we are running on our local machine so in case if you are running on the aws ec2 instance you need to provide that public ip over here okay so 127.0.0.1.4445 okay so this is the location where our selenium hub service is running okay so once it is done we will provide our selenium test cases to the selenium hub so depending upon the browser type selenium hub will forward the test case execution request to the particular node so if it is chrome browser then it will send request to the chrome node if it is firefox then it will send the request to the firefox running node so in the test what we are doing is we just simply opening the google.com we are asserting the title of the page and we will search one string here in the google search box okay automation testing and we will click on the search box okay so after waiting five second we are going to get the text of the first link okay so whatever result will be shown after you press the google search then you will get some result and from that result we are going to print the text okay whatever text we are getting at the first link in the console so this is the simple test that will happen or that will run on the chrome browser and that same execution we need to record so for running this test testing test you need to use the test ngxml file so here i am sending this parameter browser and value is chrome so for this test we are going to run this method google chrome test so before running the test case make sure your selenium hub and all the containers and up and running okay so we have seen that from the powershell and same you can see from the docker desktop application as well okay so you can see the logs as well okay so for the uh selenium video container you will see this is the location where we are going to get the video inside the container okay same video will be available in our local machine so on the local machine if you see inside this folder we have this docker compose baml file okay that we have run so you can see this folder is automatically generated and we are started that container okay so inside this container you will get this video with this name okay so currently this video is empty okay so let's go and run our selenium test case and it will record the video so tess gets execution started on the chrome so on the grid you can see one session has started and you can do the live monitoring from here also so just add secret here okay so research automation testing and it will get this text the first one so after waiting 10 second we are closing the browser so in the console let's see if we get the output okay so here you can see text is automation testing tutorial what is automation testing okay so our test case execution has done now it is time to see the recorded video so this recorded video is not yet ready so we need to stop that video recording container so that video will be available on our local machine okay so we'll need to stop the container for this video okay so to stop the container just use docker stop and use the container id that is one seven okay container has stopped now so now if we go to the local machine now we'll see 4.64 mb file so just open this video in vlc player so you will see actual time for this video is 9 minute okay so it has started the recording when we start our containers okay so it has opened the chrome browser it will go to the google.com search the automation testing and it will face this first link okay so this is the test case execution that actually happened on our chrome node okay so it is very helpful feature from the selenium grid uh grid four okay so that you can record your test case execution which is happening in the night automation okay and using those videos that will definitely help you to debug the issues okay so i have shown you how we can do it for the chrome so you just need to add the different services for the age and firefox in the docker compose ml file and add the s video and firefox video similar to this okay so that video will be available on your local machine under this whatever folder name you have provided so this folder name will be auto generated on our local machine and you need to stop the container first okay so before stopping the container you will not be able to play that video okay so using docker stop and container id you need to stop the container and then that video will be available on your local machine so try this from your end guys for the age and firebox and let me know if you face any issue in that so thanks for watching guys i will see you in the next video [Applause] [Music] [Applause]
Info
Channel: AJ AUTOMATION
Views: 3,941
Rating: undefined out of 5
Keywords: selenium grid, selenium grid record video, video recording with selenium grid, selenium grid 4, selenium grid 4 video recording feature, record test execution, how to record selenium test execution, selenium test video recording, How to Record Selenium Test Execution Video, Docker with video recording, Video Recording of Automation Scripts on docker, selenium grid 4 docker-compose, selenium grid 4 docker-compose for video recording, selenium grid tutorial, selenium docker
Id: r1gdJ-QICmY
Channel Id: undefined
Length: 12min 58sec (778 seconds)
Published: Thu May 19 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.