Selenium Grid (Standalone, Hub and Node and Distributed Modes) - Selenium Python

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello all welcome to selenium python training Series in this session I am going to explain about selenium grid and I am going to show you how to implement it with detailed practical demonstration so let's get started before I practically demonstrate how to implement selenium grade and all in the selenium python automation at all okay I am going to first explain what exactly is selenium grade what is selenium grade first of all so what is the purpose of the selenium grade what is selenium grade okay I'm going to answer that so to answer that I'll take you to this webpage I'll open this website page in any of the browser here and once you are taken to this page you can see this is what is selenium grade selenium grid will contain some hubby nodes I'll explain okay first I'll explain the purpose of the selenium grid so that you'll understand this diagram later let's say this is your laptop and without selenium grid you only will have this laptop okay remaining part this part will not be there only this laptop part will be there and if you are running your automation scripts without the selenium grid configuration here your scripts are going to run only in your laptop no matter how many scripts are there all the scripts will run only in your laptop what if what if I will connect my laptop to multiple devices like this okay I'll connect my laptop to some devices like mac machine one Mac machine will be connected to this laptop in the network a Linux machine got connected okay a Windows machine or multiple multiple Mac missions Linux machines and windows missions got connected not only machines but also the devices like a Apple devices and Android devices also got connected to this laptop now when you run your automation scripts instead of running all your automation scripts in the same laptop if you want the scripts to get distributed across okay if you want your scripts in this laptop instead of running them in the same laptop the scripts need to get distributed across uh multiple devices and machines that are connected to this laptop or the network time they have to run on the respective divisor sign machines how that is possible okay instead of running your automation scripts on your own machine rather you will connect some different machines and devices to this laptop and when you run the scripts on this laptop the scripts need to get distributed across multiple machines and devices and they have to run on them okay on on the different stuff so how that how the scripts can be distributed over the network onto the different machines and devices and run there that is possible with the help of the grid that's the purpose of the grid the purpose of the selenium grid is to distribute your automation skills okay onto the different machines that are connected in the network to your whatever the device or missions that are connected right grid will distribute that automation scripts over the connected things so this is what is grades so the main two technologies you have to understand as part of grid is one is Hub other one is node okay up and node so we'll configure half by node okay so nodes are nothing but we generally configure nodes on the devices or machines where you want to run your after distribution over the network okay those are the nodes the scripts will run on the nodes and what is up will okay we'll run Hub or launch hub the purpose of the Hub is not to run the scripts rather the purpose of the Hub is to distribute the scripts okay from this laptop whatever the automation scripts are there they will get instructions to run but they will not be running here okay Instead The Hub will collect this scripts that need to be run and distribute them across multiple machines or devices that are connected to this laptop okay and up Hub will distribute that's it but the scripts are going to run on this nodes okay so nodes need to be configured in these machines and devices and by by configuring nodes or launching nodes in every machine or devices that is connected to our laptop okay the scripts will run on the nodes okay only where the node nodes are launched description will run on those devices and machines only okay and where the hobby is launched the Hub will collect the scripts that need to be run and distribute them across multiple machines which have nodes configured so hope you got some concepts of hubby node okay and all the stuff what is selenium grade why it is required what is the purpose and all okay that's what you that's what uh you need to know yeah okay before we go for the next topic so what is selenium grade is clear for you now the theoretical part is done and uh few more theoretical topics are there okay there is older version of selenium grade and the latest version of selenium grade now selenium grid 4 is the latest as when I'm recording this session and all right selling number four is the latest but uh what is the difference between the older selenium grade earlier whatever selenium grade used to be there orbit is different from the latest whatever we are going to use now I am going to show you so in the older only one mode used to be there okay only there is one mode uh to set up this selenium grid to distribute the automation scripts across uh different nodes and run them right with help and all only one word is that that is called as Supply node mode okay there will be one Hub as I have shown in the diagram that this is the older one older one okay this is also there in the latest also but there are other types also okay apart from this model there are other models also but in older older selenium only this model was there okay this model is not only there in the older but also they're in the latest edition with it also but this was the only one that was available in the folder okay one board that is there in the older selenium grid so there are two components here one is half one is node you already understood what is up behind what is not here right uphill distributes automation scripts where nodes node configured machines and devices well run the scripts okay over the network obvious for distribution node is to run the scripts so these are the two components we have in order to run your automations uh scripts by Distributing them across multiple machines right you have to uh configure and launch up and also we have to configure and launch node on multiple machines and devices on the network where you can run your automations okay that's what is the purpose but hobbies for how we generally configure on this laptop itself configure and launch on the laptop itself and the responsibility of the app is to collect this automation script that need to be done and distributed democracy machines where nodes are configured okay like that that is called as Supply node these are the only two components we used to have in the older version but what is the difference between the latest and older version in latest version we have three modes here only one mode is there that is how by node mode but in the latest version we have three modes one is one of them is a by node but apart from the upper node we have Standalone and distributed mode okay there are three modes here Standalone applying mode already there here in the older version the same mode is also there in the latest titanium green but it's only one of the mode apart from this up and normal which is there in the older version we also have in latest version we can also have standard onward and distributed mode okay I'll explain more about this Standalone distributed and all the stuff okay in this session first let's go with the Standalone mode in Standalone mode okay it's a union of all the components of selenium grade and all okay I'll explain more about the components of selenium in the latest version of selenium grid here only two components were there right here in the latest version of selenium grid only two components are there that is half and node mode okay so but apply node of the two components in the order but in the latest there are many components what are the different components we have router distributor node session map session queue event bus so here simple terms as I have to explain here only two components are there by node but in the latest there are more components that means node is still there here but Hub is Hub is broken down into multiple components you see instead of Hub we have this is broken down into multiple components in the latest uh cylinder that is router distributor in a while okay don't worry about that so that's what okay these are the many components we have now coming to the latest version of selenium grade we have the Standalone mode by node board and distributor coming to the Standalone mode all it's a union of all components of selenium grid okay we don't have to run this different components separately we don't have to configure router we don't have to configure the distributor we don't have to configure node we don't have to configure selenium Maps separately selling into event bus we don't have to configure okay so Union of all components of selenium grade Standalone is a union okay only one thing will be there and that will run all the components of selenium grade including node and all this uh uh have broken down components like router everything will run okay if you want to run all the components of selenium Greek in a single machine for example here in the diagram there is one single machine right the same machine if you want to configure hubby node this machine itself is a hub and this machine is only configured as node okay that means the scripts will run in the same machine there may be some situations where you need the Standalone mode where you don't want to run your automation scripts across multiple missions and all but rather you want to configure with help of selling ability if you want to run but still your automation script should run the same machine in that case we generally go with the in that case we generally go with the standard one word and uh so I'll I'll make these things uh kind of practical and all okay so Java is required to run the below commands Okay so Java is required to run the below commands if you don't have Java and all right uh you cannot take advantage of selenium gray okay for selenium grade to launch and configure and launch and run right for that we need this Java as a predict site software okay so so information already Java is installed okay uh latest LTS version of java is installed jdk some 17 LTS version for installing my machine you can have any LDS version in your machine you have to install and configure it after installing the Java right you have to go to the environment uh this edit system environment variables and we have to add Java underscore home that process you already you may know right here I'll show you otherwise okay and go to the control panel and press C whether you have Java software installed in your machine or not click on that and click on uninstall a program and select J here you have installed it after installing you have to configure edit system environment variables okay if you go to this uh and click on Advanced and click on environment variables right here we have to make sure that you have Java underscore home here see whether we have Java underscore home no right we don't have Java underscore home better to add it click on new and write down Java underscore home okay if this Con uh this uh configuration is not there you have to do here we have to give the path of the Java click on this folder go to the drive uh the drive and after that you go to the program files in that you will find Java folder in that you'll find jdk whatever the jdk version I installed copy this this is the Java copy this and I will come back here and paste it and say okay now underscore only then now find the PATH select and click on edit here you see whether you have this uh uh Java pin till bin folder we should have the Java you know but it's not there so what I will do is I'll go inside the bin folder copy this till the bin folder I'll copy and come back here and just click on new and paste it that's it say okay say okay now Java is also configured so for this uh selling I'm going to work right first we have to have Java okay I'll explain all these modes or three modes of selling latest selenium grade old one is not uh you don't have to worry much just for understanding what's the difference between older and latest versions of selenium gray in older version there are only one mode that is up by node this are by node are the two components we used to have but in the latest we have three modes not just one but we can run the selenium three modes in three ways you can say in Standalone way where hubby node will be on the same machine so if you want hop on one machine and node on a different machine or multiple nodes on different machines then the second will work out okay second way is working out there is a possibility that selenium grid has given us where you can set up hubby node in the same Mission okay you can set up selenium grid by having node on the single machine itself okay the scripts will run there itself in the same Mission but they have given the flexibility this kind of flexibility where R by not big can be part of the same machine whereas Supply node is there where a will uh how will be one that uh your laptop where your automation scripts will be there where node will be different machines where you want to run machines or devices where you want to run your automation scripts right this is uh same as the older uh now there is one more mode that is distributed mode so it will give you a lot of flexibility I'll tell you more about the distributed mode later but for now we are in the Standalone mode and other thing we understood is uh in the selenium grid 4 we don't have just two components we have different components like node up and hub is broken down into multiple components like router distributor session map session grind event bus okay so when we go to the distributed more right this components will be of more use for us okay to understand now first let's go with the Standalone mode where we are going to set up selenium grid latest version uh on a single machine where the machine will act like a hub and machine the same machine will act like the node okay to make that happen first we should have Java installed in our mission not only for the standard one but also for Hub node and distributed everything requires Java here okay you have to install and configure in the way I have just now shown how to do that here I'll type selenium.com and I'll go to the downloads after going to the downloads uh here you see the first one is selenium server in the brackets you have grid this is what is selenium gray and here's latest version stable version when I'm recording this session is 4.9.0 just click on that whatever the latest version it will get downloaded like this selenium server means selenium grid only with some version okay so let it download let's wait for it to get downloaded completely you can see it got downloaded now let's go to the location where it got downloaded so now create a folder let's say you can create this folder anywhere in your machine I'll just say selenium grade files like this okay and cut from here and paste it here okay so apart from that I'm going to download other stuff like drivers okay for different browsers there there are different drivers available again you have to go to the same location selenium dot downloads and scroll down until you see some section known as browsers so in my project I am using three browsers that is the edge browser Firefox browser and Chrome browser so I would like to download the drivers for the Chrome Firefox and ads for now and click on this under Chrome you have documentation click on that will be taken to this page and click on downloads you'll be taken to another page current release is there first let's check the browser version of the Chrome click on this and say help and say about Google Chrome let's see what is the version I am using 112 point something okay here you see one 12 point something is a click on this chrome driver the version should match the Chrome driver version should match with the Chrome browser version okay so is it downloading so here once we click on this link right it has taken us to this page where you see for Windows only 32 bit user click on that okay since my mission is Windows I have to download this if if I had windows 64 64-bit I would have downloaded that but for now they are only providing 32-bit that also works in 64-bit machine that's okay so I have downloaded the Chrome driver zip file came I have to extract that right click extract all click on extract once you extract that copy this chrome driver.exe file and go back and in the folder whatever you created Cell integrated files paste it okay now you got uh Chrome driver.exe along with that you'll also download uh the other drivers result again go to selenium.io and uh then go to the downloads and go to the browser section again and here we have Firefox click on documentation chair one table is there which version I have to download for Geico driver but for Firefox we have Eco driver okay for Chrome browser we have Chrome driver only but for Firefall they they are not calling a Skyfox server they are calling it as giko driver that's okay which version of gecko driver I have to download so for that here we have to see and since we are in selenium python that we are using selenium python so here there's one version 3.14 or above my version is more than four actually since 4 is already greater than 3.14 you don't have anything much this version is suitable but it's not that's not the only check you also have to check the version of the Firefox that should be Firefox browser version click on the Firefox browser launch the Firefox browser and uh we'll check the browser version of Firefox now once I show you the Standalone mode right uh you'll understand remaining things very easily okay there's nothing much so go to these and uh here say help and uh say about Firefox you'll get the version of the Firefox one 12.0 but here go to the table again go to the table one or two is less than 1 12 it can be maximum it can be anything so we can choose this latest version of gigo driver click on the key code driver releases here and here on the top we have the latest version 0.33.0 scroll down and here we we get the links to download okay so I would like to download the windows 64 because they are giving Windows 64. I'll click on this so it's getting downloaded now once the zip file gets downloaded right click showing folder extract that zip file extract all click on extract the extracted folder you will get gikodriver.exe file copy.exe file go back and uh put that inside the selenium grid files paste it okay similarly you can get the edge driver okay similarly you can get the edge driver again type selenium and go to the downloads scroll down go to the browsers click on edge and uh you'll be taken to this web page now you have to find out the edge browser version in your machine click on that click on this health about Microsoft Edge once you say about Microsoft Edge right uh checking for updates is coming here one minute so what is the version one 12 point something is there we have to go to this and say one to L we have to find that one to l 112 find something okay we can go with the whatever that is latest C is there for no generally it should match the sub versions also should match but if it's not matching if there's no other way I will go with whatever that is latest Okay click on this 64 bit it's downloading but in real time we should uh exactly match the browser version okay but if the browser version is not exactly matching then you can try to download the nearest one that's the only way right it is got downloaded okay open file zip file got downright already so let's go to this where is the zip file this one extract this uh and you'll get the edge driver.exe file once you get the msh driver go back and uh put that inside the selenium grid files now after pasting it here now go back and put keep only this folder remaining on folders you can delete there's no use right so why to get confused and all I'll just remove all the stuff these things also removed so also it's not required now we have this set Integrity files folder with all the required things like selenium grid jar file and drivers for different browsers we have okay if you don't have the driver you will get some problem is in the next step so better to have this selenium grid jar file along with that you should have the driver file see none of the things are there you will get some problems okay should be there now select this and type CMD and now from this folder where this driver files are approved and the selenium grid jar file is put right now type Java iPhone jar use this command if you want to run you should have Java installed in your machine that's why you have installed Java information and configured it Java hyphen jar we have to now give the name of this selenium server that is a selenium hyphen server hyphen 4.9.0 dot jar if you just directly press enter right it will give you different options for running the selenium grid okay intentionally I am giving this command and after this jar I have to mention Standalone some kind of things I have to mention but I'm not mentioning any press enter without mentioning right it will give a list of commands available you see you can mention no you can mention how you can mention uh Standalone sessions like that okay after this comment you can mention any of this uh commands fine anyhow no need to worry much now uh what I will do here is I'm going to demonstrate Standalone mode how to run the selenium how to set up the selenium Grid in stateno mode same way okay close this again and from the same location type CMD here the command prompt will launch at the at the same location that is uh at this path itself download files and here we have run the command Java hyphen jar and after this you have to give one command okay what is that command for Standalone mode if you want to set up this linear Grid in Standalone mode or run the settings Channel or not so after this command you have to give one keyword that is called as Standalone keyword you see this one we have already typed after this you have to give Standalone so that selenium grid will launch in which more concrete configured and launch in Standalone mode that means you're configuring the hardware node in the same machine how by node are part of the same Mission the scripts will run in the same region so here stand alone stand alone okay now press enter selling upgrade will start is the command for starting the selenium gradient which mode Standalone okay okay you see Microsoft Edge got added because three three drivers we have good right so three three adding Edge for uh Edge options okay then Chrome for Chrome options Firefox for Firefox options once you run this selenium grid once the selenium grid is running right you can do one thing uh there is one URL actually I don't know where exactly that is I'll find it out yeah here it is it is there after running this uh you have non-ui version you can say localhost colon 444 status okay so here I'll write down EP colon double slash localhost colon code 444 slash for the one status type status here and press enter you see this kind of Json text will come this is a non-ua version what it is saying selenium is now ready it's running actually okay and uh I mean the node information is also coming you see node information is also coming so but this one is Json so it's better to have a UI version that is more better than this Json version but the UI version for UI version you have to add uh you have to remove the status thing okay only up to four four four we should put just remove the status it will become the UI mode just press enter you'll get the UI mode okay you can visually see what's what's there okay you see if there is one uh node right this is what is a node okay Hub is nothing but this one and in that there is one node here the node is running here on this machine having this IP address and the port number the node is running and you see uh there is a vacancy of E8 browsers in Chrome to run the automation skip track and run in yet open instances and uh yeah it vacancies how many slots are there for running your automation so Z plus eight plus eight twenty four are there okay total 20 and 24 answer so here none of the automation scripts are currently running though okay but this is what is a node okay this is what is a node if if I close this right if I have not uh started selenium grade here you would have got some unable to reach out or some kind of error you should get okay but once the selenium it is running here in whatever the mode it may be Standalone or have by note mode or uh the other mode that is uh distributed mode right any of these modes right you'll get this kind of page okay where this this box is nothing but the node information only one node is there right okay like that so if you run your automation scripts from selenium python right the scripts need to run on this particular node okay so what I will do here is I'll just go to this one of the projects selenium python hybrid framework project with Pi Pi test type I created in one of the previous sessions right that uh that framework project I took so in that here we have the individual test uh python files I'll go to the cons test.py file I'll open the contest.py file where we have this kind of uh fixture methods okay here one of the fixture method is uh setup and TR down here we have to change this code a bit you should not be having Webdriver dot uh Chrome and all those stuff so we need to update this code how to update this code in order to update that code uh we have to take the help of okay this this will not help us in running your automation scripts on the selenium grade for this uh selenium python script to run on the selenium grade here we have to update this picture method a bit okay this is not the correct way we should not be writing webdriver.com webdrive.fox this should not be like this okay rather we have to write in a different way where here I'll say something known as uh desired cap is equal to none I will say okay and now here I'll writing instead of writing webdriver.com right we have to write something with help of desired abilities we can write as a desired capabilities so desired result one minute I think it's already imported here but uh generally it won't be there okay when it is not there how does it look it will give you some error what are the amount and import this from selenium after that click on Dot and you can select Chrome and say dot okay if the browser is mentioned as if your scripts need to run on the Chrome browser right then this is not required driver is equal to Webdriver dot Chrome is not required to remove that okay it should be desired capabilities.com dot copy and it's going to return you uh some object and you this is object difference okay is equal to done but if the browser is Firefox in that case instead of this line we are going to write same desired capabilities dot we have Firefox here say dot copy again and it should also return you this desired cap here here also desired capabilities dot edges there dot copy it should return you this is that cap which is pasted here done so these three items are done so once you get the desired cable design uh where we are going to use this is that Gap based on the browser selected either this desired capability or this desired capability or this desired capability will be decided that's okay but uh where we are going to use desired cam I'll tell you here after this I'll write down Webdriver Dot something known as remote you circular brackets now press enter now press enter now in this you have to give something what is that something I will cover here I have documented it just give me a second where here at the end I guess yeah here so we have to give this in remote we have to give command executed okay just type command you get that command is utter is equal to then you have to give this this URL okay just give this URL so here HTTP colon double slash here is here Hub IB what is the high by B where is this Hardware link is running here you see you can clearly see the IP address right where the Hub is running so you see here this machine's IP address you can find it uh switching node edit node started selenium Standalone at this okay this is a hub so 192 168 0.108 okay that you give here the simple nothing but the IP address of this machine kind of stuff where the Hub is running 192.168.0 Dot you can see that that's okay this part is good comma for the next one we have to write this otherwise you know if you don't mention this code right uh if you don't modify this uh setup entry add-on fixture here with this desired cable Design This is a web driver dot remote thing then your scripts are not going to run on the selenium grid okay so this is a part of the selenium period only whatever we are doing now go back there's a few more things that you have to add apart from the command executor we have desired cable list now whatever the desired capability we have set here either for Chrome or Firefox or Edge based on the map of the browser where you're running your automation script this is desired cap you have to pass so here I will write a desired capabilities is equal to this particular desired cap okay it will decide the browser and all well that's it this is not required okay you can ignore this and remove from here it's not compulsory okay then this part is done and uh and now this remote will return you the driver driver is equal to you have to say the driver will be used here that's it anything else I have to do I don't think so everything is fine now okay these what are the changes you have to do in the setup interior down fixture of this framework project once this is done your scripts are going to run on the selenium right now okay now run the scripts now selenium grade is set up in your machine in which mode selenium grade is set up in your machine in Standalone mode you are already setting where it is running and you have already checked here the status where one node is there okay you can again check if you want the center and check the slash UI also you can there's one note this box is coming means there is one node if there is no node that means this box will not come okay so there's one node open wherein Chrome browsers we can run the scripts Firefox or edge browser in this node machine that is Windows same machine is nothing but the node there right up by node is same image okay this Windows is Chrome this file for this that's otherwise so here I'll simply say Pi test to run the scripts I will say Pi test and under the list package under the list package we have different uh login register such I'll go with the search test underscore search dot pyl 10 press enter will run let's go to the sessions and see if there are any sessions concurrency zero percent description you just start running for that why it's taking so much of time let's switch everything fine now browser to that cap Okay Chrome copy file can be given I think it should work fine I'll say Ctrl C here just to stop this Ctrl C this time it should run the browser and all but uh I'm not seeing anything so the remaining browsers are close okay okay let's wait if any error will come and let you know okay looks like there was a temporary glitch or something I just updated this URL nothing much I just typed it again earlier I copy pasted right so maybe that was the reason why it was not working so I just updated this URL okay I just typed it manually again okay so let me try that now uh I'll say buy test under the test package test underscore what is the test underscore such Dot py okay press enter three item now scripts are running you see I just removed that and typed it manually okay that's scripts are running and meanwhile you can go back here and see is that UI ring you see some session two something is going on here some sessions are going on right this rows that something is running on the Node okay that browser on the selenium grid node the scripts are running one session still going on I don't know as the scripts got completed let's see yeah one failed to pass that's okay intentionally one got failed anyhow sessions so yeah one session is still running it seems why I don't know why it's running still but that's how that's how it works okay that's how it works on the Node Mission the scripts are running this project on the Node Mission the scripts are running here also you can see something releasing slot assigning slot that means uh on the Node Mission the skips were running where it was the node was assigned slot was designed and after that uh script Got Run nor got released okay this rules are in selenium grid Standalone mode we are able to run the automation Scripts similarly there are other modes okay so if you understand the Standalone mode uh how to run and all the same code will be there you are not going to touch this selenium by some code okay selenium python code you don't have to touch that is going to be same but other modes you have to understand different modes this mode is uh same as the older mode where you have to launch Hub in a separate way separately and no browser separated in Standalone mode with a single command both hapai node got configured in the same mission same Mission will become the Hub same machine will become the node but in a by node you have the flexibility of uh having one machine as Hub and other machines as a nodes or you can also make the same machine also as combine node by launching both and hub and node in the same machine you can do that but I'll close this command prompt because I'm going to now run this selenium gradient second mode that is mode okay Standalone mode already close the command prompt where where the selenium grid has started in standard but now I am going to start the selenium Grid in upper and node mode okay the second mode so if you want to run Hub in one machine and node in other machine generally we choose this mode okay if you want to run both hardware and not in the same machine we go to the standard remote but if you want to run Hub in one machine node another machine we'll use a buy node mode but I don't have multiple machines will be in with me okay with me I don't have multiple machines to show you how to run Hub in one machine and load in one machine okay I cannot do that so I'll make the same machine node okay but I'll I'll first launch Hub in the same Mission and I'll make this node separately by launching node in the same Edition okay so Hub is a union of the following components okay there are a lot of components using selenium grade four Hobbies Hub is a when you when you launch Hub right when you launch Hub automatically internally you are launching router distributor session map new new session q and event bus okay these are the things how the scripts are distributed across multiple nodes with help of this these are following components which together will form Hub okay but here you don't have to run this router distributor session map you don't have to one by one launch it okay or start them you don't have to start this uh individual components rather if you launch this Hub component automatically they will be launched okay start hub using there is a command you have to follow so here go to the location where we have put that selenium grade jar file for the downloads uh there was one folder right in my machine so let's go to there and here you have selenium server that is related CMD the center you'll get the command prompt in that type Java python jar selenium hyphen server hyphen 4.9.0 dot jar and here instead of giving Standalone you are going to give what hub okay and just how we are going to give because when I refresh here since no selenium grid is using the site confidence is not running here right I have to run this command to set up the selenium gradients up by not good then only this URL is going to work at this moment this URL is not working so it can't be reach it is coming but uh when I launch up you will see that okay first we'll launch up we'll make this machine as a hub first of all foreign combination of these different individual components you just don't have to start them individually rather you just uh start this up they will restart it automatically okay event but bus is ready sockets are ready then uh let's see this is selenium Hub started at this uh at this ip192 168 0.128 sodium have already started that's it now we have to start the node in the same region I actually we generally start this node in the different machine but uh since I don't have multiple missions I am going to start the node in same issue um again go to this folder without disturbing this uh command prompt what is the same location type CMD again one more command prompt will launch now we have two command prompts one and two the second command new command prompt what I'm going to do in the new command prompt is here I'm going to type Java F1 jar selenium i1 server hyphen 4.9.0 dot chart space I'll say no attitude node in place of up we have to give node press enter the node will start here you see say started selenium node 4.9.0 at this location in the same machine it got started now refresh here you see you got this node display right now if I close this if I close this node just refresh here uh in a while it will come still it's coming up it is up how the node is coming let me close and say uh what is that command we have to use find the status and all we have to run this command localhost status and go there paste it remove that okay somehow it's coming though even though it's not there let me close everything refresh you'll not get anything inside configuration is coming now what I'll do is again I'll go here and run the command CMD foreign hyphen server in a mistake I have done here hyphen should be there I gave Dot X and four point nine point zero dot chart now once the hobby started we will refresh this page okay before the upstarted site can't be reach is coming once I start the Hub here let's refresh the page and see what's happening started up come back here and refresh you see the grid has no registered nodes there are no nodes actually only up is there but nodes are not there to launch the nodes will automatically come with a single command that is Standalone command but in Hawaii node mode you have to separately launch up separately launch node so here I'm launching after launching The Hub right I'm launching node now uh selenium hyphen server hyphen 4.9.0 dot star space Center now we are launching node earlier there was no node now when I'm launching node so once the node starts here started selenium node now refresh here this page you'll get the number you say you got the page note this part is a node on this node the scripts will run okay still we are configuring up and not in the same machine instead of doing that you can actually go with Standalone because the same machine if you are having node means that is called a standalone right why do I have to type two commands I don't have to run two commands here right simple shortcut is with a single command but here there is flexibility of launching up and node separately so by running this how by not instead of mentioning Standalone in this command at the end you have to run up you have to mention hubby node okay fine uh so run the scripts and see whether this in this mode the scripts are running on this uh the scripts are running on this uh open node mode or not the second mode of cell enumerate right this package uh test underscore search dot py okay I am choosing this just searches because there are only three scenarios I mean three three just inside so I'm just choosing the test scripts are running you see and you can also see this node where uh you see in this node the script is running it's not the script is running for the session sensing nokius I think it's second one is running I guess skips are running you see the scripts are running and uh once it is done once the node is released you see this is happening now let's see you see the skips dot run now you see there are no zero sessions okay any zero sessions fight and done is also done how to run the strips in Hawaii node Board of selenium but in uh but how to set up this hubby node in separate machines where if you have nodes on a remote machines and all how how does it happen here the commands will differ a bit in the same machine if you have to launch Hub and node will generally directly launch like this but if you have to start notes in different machines okay instead of a launching node like this okay in the normal way if if there's a different machine on which apart from this machine if you have one more machine where you want to launch node in this machine you launch your Hub right another machine which is connected to your machine you want to make that other remote machine as a node machine in that case you have to provide the IP address of the node so this is the command you have to I'll show you how to type the command for node if the node is to be configured on a different machine apart from this machine where the Hub is configured then the command will differ a bit okay so just see what I am doing Java iPhone jar selenium hyphen server iPhone 4.9 Point till here it is same after that this node is also same but you should not stop here you have to give the remaining views hyphen iPhone this is extra thing you have to give detect hyphen drivers true iPhone iPhone publish publish hyphen events then TCP colon double slash here you have to give the IP address of the Hub where is Hub Hub is running here you see when you stop running this up only right is a hub and the Hub is running here on this IPR 192 168.0 dot if this is separate machine this IP address will be appeared of that note machine will be different and hub machine will be different anyhow in the node machine you have to give the IP address of the hubmission that is 192. once wherever the Hub is running right that IP address of that half machine you have to give here followed by uh then you have to say colon 4442 okay you see here uh okay somehow 4442 I don't think so we have to give 4.42 there connecting to uh okay so where is that how right let's give 444 only four four four four what number or we should give that iPhone iPhone okay you have to give four four two only whatever that is there in the command you give that iPhone iPhone subscribe hyphen events TCP colon double slash again give the if this uh node is a different machine in a different machine then you have to give the IP address of the in that node Mission we have to run this okay in that node machine we should copy all these files into that particular along with having this in the hubnation also copy this folder uh into the node basis in that node Mission you have to launch this command prompt where you have to mention all this stuff okay setup started a selenium node or refresh here once it's there okay now run the scripts also the scripture will work fine with this process also the script should run fine scripts are running fine and we are good sleep summary so there are two possibilities in Hawaii node mode instead of launching Hub and node mode in uh same machine there are two possible discs either you can in hubby node mode you can make the same machine as habit mode by launching it separately or you can only launch Hub in this machine and another machine you can launch the node okay so the scripts have run everything got executed successfully session three and on refresh that's all good find next mode I'm going to demonstrate the supply node mode is also done standard mode is also done the next mod is distributed mode the last mode for this session is distributed mode which got introduced the Standalone mode and distributed mode are the new ones since latest version of selenium grade okay so coming to the distributed mode it's gives you a lot of flexibility instead of launching Hub only Hub is internal launching lot of components right uh a here node is node is there but apart from node we have router distributor session map session queue and event bus in selenium grid latest version okay but uh in this hubby node mode all these components sub components of Hub are launched with a single command on a sub command but here there is a flexibility in distributed mode where you can launch them separately okay in this mode we have to start all the components like router distributor Etc individually using separate commands instead of launching Hub and hub is actually launching all these multiple components uh individually rather we have the flexibility of launching all these components separately one by one okay we have to use this mode when we have a large size upgrade okay to set up if you want more customization and more bigger complex setup is required then we generally go for this distributed mode okay this comes into place when uh there is a project where you know at most carries should be taken uh with selenium grade in setup setup in this component separately and all if there is a requirement we have to do that okay let's uh let me show you how the selenium uh this uh components what are this components what are the active why we need all these components And all I'll explain now you can close this you can close this up by node now because we are now going into the distributed one if refresh nothing will happen unable to reach out something will come site can't be now open this URL you see this is addition uh these are the different components we have in the latest selenium grid these are the different components we have in the latest selenium gate you see there is no node is there apart from node there are five other components right router session Cube distributor session map and event bus these are part of the Hub actually but now we got the flexibility of not launching The Hub as a whole rather we have the flexibility of launching this uh individual components of the separately distributed mode of selenium period okay there's something known as router session queue distributor event bus and session mapping okay and the nodes are the place where the scripts are going to run the machines are devices where the scripts are going to run right there we are going to launch nodes and apart from that we have this other components of sending membrane known as uh this thing session queue okay when you run your automation scripts right when when you start running your automation scripts here the scripts need to run need to be run on this node missions will go and wait here Q means they will wait in line okay they need to be run on these nodes if there are a lot of scripture writer they have to stand in line one by one they have to run on the nodes session Q is that one okay then what about distributor the role of the distributor here the scripts are waiting to be run on nodes okay before running on the nodes the scripts are waiting here what is the role of the distributor the role of the distributor is to pick the scripts which are waiting here for running on the nodes from here it will pick and it will distribute Accord according to the available nodes okay some nodes will be busy sometimes already some automation scripts are running on some nodes some nodes are kind of their no scripts are running on some nodes who will decide on which node uh this uh distributor will decide okay distributor will collect the sessions which are in queue here in this session tune component and distributor component will allocate some nodes where this uh automation scripts can run okay that is the purpose of the distributor and there is also something known as session map okay there's some session map here in the session map the uh the the automation scripts which are waiting in queue the ideas of this uh automation scripts which are waiting in queue and the IDS of the nodes the IDS of the nodes which are available or whatever it is will be mapped here okay the distributor will map the pending automation scripts to run with the other nodes okay and it will map here this is just mapping that's it okay which scripts are going to run on which nodes are the mapping whatever the mapping is that will be maintained here now there's something known as event bus buses what's the bus purpose Transportation right if you want to go from one location to another so bus will take care of the communication between all these things okay all this components uh need to come communicate with each other right that communication will be happening via bus okay the communication uh something need to be stored here by distributor okay event bus will be taken to travel from here to here even bus will take that message or something okay that is the purpose of the event bus but who will direct the event bus to go in that particular direction router will do that okay so session queue need to use this event bus to go to distributor okay who will decide that router will decide on which path the event bus need to travel to communicate uh to make the communication happen between different components here okay but session Q2 go to distributor even even possible just is a transport means but direction will be given by router okay in which direction it has to go from here to here or here to here who will decide router will decide so these are the different uh components we have in uh selenium grade okay notes and how this part is half but half is broken down into router session view distributor event bus and selenium map session map components okay so this is what is a uh if you have to understand distributed mode you have to understand all these components that's why I got you there so fine now let's set up this selenium grading distributed mode where we are not going to just launch hubby node but also in place of we are going to launch all the different components of uh distributed mode that is Hub mode okay something so fine let's get started so first let's uh start the event bus okay first component there is a this event Bus Let's Start step by step we have to start the event bus already explained the purpose right communication purpose only Transportation purpose so we have run like this go to that same folder where this files are available CMD and type the command here Java hyphen jar selenium hyphen server iPhone 4.9.0 dot jar space now give that event hyphen plus you give okay which of launching uh Hub we are launching the components house separately okay that flexibility is there in the latest version of sunny deol and this is requiring complex requirements and all okay event bus will start now we are not starting up rather one of the component of we started okay started selling it event bus at uh 192.168.0.10 and uh 0.108 at this port number five five seven okay the next one what's the next one after starting the one of the component next component we are going to start the recession map s the session IDs of the running node sessions okay whatever the uh this uh in this here whatever the nodes whatever the automation scripts in this nodes are running right that session IDs are mapped with this node ID okay in which node the scripts are running we can identify that okay so this uh session map we have to run how to run the session map same thing here at the end you have to say sessions sessions is a command okay for a running event bus launching event bus event hyphen bus we have to launch we have to provide sessions here okay so here I'll write uh I'll again go to the same folder I should not touch this rather I have to launch a new command prompt and type foreign space sessions session map we have two Sensations okay started session map you see session map started 0.108556 port number done next one after the session map we have to start session Q adds a new session request to a queue okay this queue will be processed by distributor later okay the automation scripts that need to be run on the nodes will be waiting in the session view as you know okay distributor will collect the automation script from the session queue and run them on the nodes and direct them to the nodes so to run the session queue we have to give session Q command like this again go to this folder and type CMD and uh once prompt will open right Java hyphensar selenium icon server iPhone 4.9 point zero dot jar space session U whatever just so let's see session Q is session uve UE press enter third component of the Hub we are running separately started selenium 2 at this uh 192.168.0.1555559 port number okay that's good next one is distributor this uh distributor okay so distributor checks uh will check the session view to see how many automation scripts are still in pending mode and uh since the notes are registered to this question receiver knows that which nodes are kind of uh uh are uh you know have the slots available for running this pending automation skills and accordingly it will allocate the scripts to run on that particular available nodes okay so that is the role of the distributor as I already covered now how to run this this is this command is a bit different okay so go to this uh and type CMD just carefully type this command it's kind of different when compared to the previous ones so here we have very additional things Java iPhone jar selenium hyphen server hyphen 4.9.0 Dot chart space distributor distributor hyphen iPhone sessions here you are connecting distributed to the sessions okay the recession map or whatever it is okay sessions where this is sessions are running session map is running this session map is running at 192.168.0.108.556 so give that one nine uh how to give that HTTP colon HTTP colon double slash 192.160 guide dot 0.108 colon 5556 I guess let's confirm that again is it same session map at 0.556 only that's correct we have correctly space now give session view after session map give session you type an iPhone session View where is the session queue running let's find it out this is session here running into same five four five nine this is okay here five four five six here five five nine but IB address is same one with different port number it is running okay 192.168.0.108 colon 5 5 5 9 it is running press enter okay still uh there's a problem right I should not be doing this okay let me run this again the command is not complete you say I was very fast here iPhone bind was false okay like that you have right that thing I didn't mention iPhone bind iPhone bus let's see uh hyphen iPhone band hyphen plus false finally pulse have to give face false and correct yes now run this again press enter let's see whether it will run or not this time start at selenium distributor at this 192.168 0.55 report number okay then router next one is router redirects the request to the correct components you see event Possible only transportation in which uh where the transpiration should be happen between which components the transportation should be happening will be decided by router Router also has a big command so let's go and type the command pick command for router type CMD and here see what's happening write down Java hyphen jar selenium hyphen server hyphen 4.9.0 dot Char space router hyphen iPhone you're launching the router but this router need to be connected with the session signed distributor here okay the sessions distributor and says three things three components I have to mention okay where these three components are running positions component is anyhow running on the same 5556 code number so we already know that I'll give hyphenappen session set http double slash 192.168.0.1 space where is the distributor running iPhone hyphen next one is distributed history view done hdb colon double slash let's find it out uh previous one was distributed only right so it is running at the same but 5553 port number so give that 192.160i dot zero dot 108 colon five five three I guess five five three done that is also done space after that session skew okay session queue is running at five or five nine port number so we can easily give that hyphen hyphen session you base hdb colon double slash 192.168.0 Dot 108 that's it so this is a router command processor let's see what will happen router should uh launch should start so instead of launching Hub is the single come and it is supported mode we are able to launch Hub by launching this individual component separately one by one okay till router we have to launch this many command prompts you see for every component we open one command prompt to start okay to start the components now go here and uh refresh here and see you're getting the Hub but node will not be there there is no node restarted so this Hub and all to this grid and all so finally we have to launch node so node you already know the command for node right uh there is simply add node here you already know how to start node in different machine with IP address of that remote uh from that remote machine we have to give the IP address of the Hub machine okay since I don't have multiple missions this already I covered as part of my node the same concept so I'll start the node in the same Mission okay you can try this in different Machine by yourself okay so starting node in same machine so how to do that simple type CMD and write down here Java python jar selenium hyphen server hyphen 4.9.0 the version that I'm using so whatever the version that is available at this moment when I am recording the session is this one and space node you have the same press enter that's it the node will start we have now set up the selenium grade in which mode distributed mode this is the way to set up selenium gradient third mode that is distributed mode and now here refresh see node already came now let's run the script to see whether our scripts are running in the selenium data nodes which are set up in distributed mode so I'll just run the same command by test test search dot py if the scripts are running on the Node then we are good okay let the script stack the scripts are starting you can also see here it's got accurate that means they are running so with this uh the skip study how will be running so these are the three modes in the latest version of selenium grid that is Standalone hubby node distributed mode in the older version we used to have only one board that is hubby node mode but now in the latest version of selenium grid we have these three modes and we should learn okay or we should have the knowledge of understanding okay so how to run the scripts on different modes okay the understanding grid setup which is set up in different type of modes so all the concepts of selenium period I covered but in real time how do we use this uh selenium grade selenium grade only will distribute the automation scripts but what is the advantage only distributor Distributing of the automation steps okay I'll tell you more after description right you see how the all the scripts got run now everything is fine so now let me explain one thing that is a here let me explain so why selenium grade is required you know the purpose of selenium grid the use of selenium grid is to distribute the automation Scripts to run in multiple machines okay so selenium grade will with the help of how bright selenium grade will distribute the automation scripts across multiple node machines which are connected to the original machine that is Hub machine so because of that this instead of your scripts running on a single machine because of the selenium grid if there are these are the different machines let's say okay which are connected to this machine if you set up selenium grid right your scripts will instead of the scripts running only in this machine the scripts will go and run in this machine this machine this machine this machine this machine but what is the advantage of running the scripts Distributing the scripts and running on multiple machines so there are two advantages sometimes you have to run your scripts on different machines like for example Linux machine you want to run cross cross missions you want to run okay so in Linux machine MAC Mission you want to run so some mobile device you want to run Android device iPhone device like a different type of Windows machine you want to run that is one person purpose that will be achieved with the help of distributed distribution of the automations with other purpose is to save the time to save the time okay to save time so if the scripts are running only in a single machine the scripts are only running in a single machine okay so there is no possibility of saving time but what if I distribute the scripts across multiple missions with the time same no still the time will not be saved because only one script will be distributed in one machine and after that is completed another script will run another machine but at a time only one script is does it save time no with selenium grid saving of time is not possible only distributed distribution of the automation scripts across multiple missions is possible with help of selenium grid but selenium grade is still not able to save the time but if I add selenium grid with the parallel execution if I attach Pi test in pi test we have the parallel education temporary panel parallel learning of the test okay selenium grade parallel education what will happen your scripts will distribute across multiple missions and while this one script is running in this machine another script will run here while these two scripts are running here another all the missions will be acquired instead of one script running one by one at a time if you have five missions five scripts will run will run so why can't I run all scripts in a single machine why I have to distribute the automation scripts across multiple machines if I run if I I can still use parallel education in single machine okay when this multiple missions are not there I can use Fighters parallel is used in a single machine but the problem is the performance okay the system will slow down your scripts if you are running all your scripts parallely in a single machine okay that will consume lot of CPU and RAM and all the stuff and your scripts will run very slowly so that's the reason the idea is that with help of selenium grade we are going to distribute the automation scripts across multiple missions and on the top of that we'll apply parallel execution so that the skips only single scripts will be running on multiple machines not more than two parallel kind of things will run in every machine without degrading the performance of these machines and at a time the scripts will run right without impacting the performance of this machine this script is running in a different machine so this combination selenium grid and pytes parallelization right will save the time okay selenium grade will distribute that as salary in Grid is to distribute the rest across multiple machines whereas Pi test parallelization for parallel education okay selenium grid will not enable the parallel resolution but selenium grade has to take the help of propitis parallel execution okay so here we have one package to be installed right uh okay so I'll give you the details here if you remember as part of the Python series I covered that okay automation script and this uh this parallel education enabled with help of private sections will run them in parallel that's the concept so what we'll do here is uh let's see I'll select this project click on file settings and after going to the settings I'll select this project Again by python interpreter and see whether the package is already there here or not Pi test exists package is there here I don't see here so let me install this I have click on this layers and say hi does F1 X test okay this came here install it without installing it we cannot run the scripts by test scripts in parallel board okay by default python doesn't have the capability we have to install this package known as white as exist to enable the parallel resolution okay to make up a parallel description possible okay so now not only that in the command line whenever you are typing the commands right CLS press enter and here while typing the command after typing this pie test and all the sudden new space and run this command uh hyphen here already the grid uh greetings are launched okay so lineability is still there refresh here you see node is also there on this node I'm going to run the scripts in a parallel parallel way okay at a time three description you need to run at a time I want to run three Scripts foreign space three okay press enter please skips need to run parallely you see one two three skills are going to run parallely and see observe this what's going to happen here in three scripts are running parallely here you know what's happening here you see three are running parallel at a time one two three are running okay on the Node mission three skips are running parallel let's see and then let's get start running parallely or not you see definitely if you're running the scripts on a single mission that will degrade the performance okay same same thing we got the output and all the slip slot executed completely and everything is fine what is how are you you see all the all the sessions are done so this is how we can run the scripts in a parallel way okay selenium grid will only distribute the automation scripts across multiple nodes I cannot uh practically show all the stuff here because I only have one machine with me so imagine that in real time you will have multiple machines where you launch having one machine and nodes in other machines okay either you can launch Hub okay go using the Hub command or you can uh you can set up Hub in your Hub Machine by launching the different components of the app that's up to you but in multiple node Nations other machines where you want to run the script so you have to launch node everywhere okay you have to learn the node everywhere and that node to be connected to the hub back and now when you run your automation scripts this Hub will take care of Distributing this automation scripts across multiple missions and the scripts will run there and if you want the scripts to run parallely on at a time one one script is running on one node machine other another mission if you want to run another script parallely then you have to enable this parallel education by installing this package by test exist package and by mentioning this command hyphenian what how many instances and all the stuff okay with this parallel education will be enabled okay try test will enable the parallel education whereas selenium grid will distribute the automation scripts across multiple Dimensions so always understood uh about all about selenium Grid in a detailed manner in this session okay it's a very detailed series I can understand okay this is what is selenium grid and that will be the latest version of selenium grid I covered in this session so that's all for this session thank you bye bye
Info
Channel: QAFox
Views: 3,981
Rating: undefined out of 5
Keywords: Selenium Grid, Standalone mode, Hub and Node Mode, Distributed Mode, Selenium Python, Selenium Python Project, Selenium Python Full Course, Beginners, From Scratch, Detailed Course, Selenium Python Made Easy, Easy Course, Free Course, Selenium Python Full Playlist, Software Testing, Selenium Test Automation
Id: MZ-k2gzhAxg
Channel Id: undefined
Length: 74min 9sec (4449 seconds)
Published: Fri May 05 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.