How to Open Browser with Pre Loaded Chrome Plugin in Playwright | Playwright with Chrome Extension

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello friend welcome back there can be many scenarios and situation when you want to have the Chrome extension preloaded in the automated browser window which is open through playright so how you can do that like how you can achieve this pre-loaded Chrome extension in the playright automated window let me show you guys here it's a very simple and straightforward thing but yes little tricky I have written the code and everything already so you see that here what you have to do you have to just add a piece of code in your script just before your test case in whichever file or you can add this piece of code in your common file and uh you can call that before every test and once you uh like and then you have the simple test case as you used to write in play right any test case just that you have to add this piece of code this I will uh give in the description as well this you have to add and then if when you will run the automation uh like when you then when you will run this uh playright code here like this let's say so when it opens the automated window here you can see the uh selector sub is already pre-installed here you can pin and if you want you can see that right on the context menu it is here and as well as if you inspect you will find the selector sub here so likewise like if you want to install uh like you want pre-loaded extension any pre-loaded extension in your browser window which is open through play right this is how you can achieve now in this code what you have to uh what you need to take care about is this the uh rest of the thing whatever is there in the code that you can use as it is what we have it here just that like uh this is the path of that uh extension code so it is uh better recommended that you keep that extension code inside the same uh test case folder here like justest under this so this is my test case File here and here you have you can see that I have kept the extension code so this is you can have it here any extension which you want to get the pre-loaded one so you keep that here extension code and just pass the name of that extension I mean that folder name here because this inside this there are files so you can just keep it here pass the name of that otherwise like if you're keep keeping uh like putting this extension code somewhere else inside any other folder any other directory then you will have to pass that directory the UR I mean path of that location where your extension code will be and then you can see that here rest of the thing is same you need not to change anything yes here if you are using manifest version 2 extension then you have to use this one if you're using manifest 3 version three then you can use this one generally like most of the Chrome extensions are now in manifest version 3 so you can uh keep it right away this one otherwise if you are using the Manifest 2 then then you can just com comment this one and use this one and uh yeah rest of the things are same here and in fact if you want to uh learn and read more about this uh you can find it on the playright website Chrome extension so here if you go here official documentation of playright you will find it here somewhere Chrome extensions yes so you can find the same piece of code and more information here right from their website so yes here I have shown you how you can actually put that code in your uh test and how you can uh like with the live example because here you will find it uh the code but uh yes real example with the running code you can see it here how I have shown you and then you can use it so let me just uh show you guys once again by running the piece of this piece of code so if you uh ever uh want to have this you can just have this and uh add this piece of code in your uh playright script and then you can just simply run it it's a very easy and straightforward right click you can see the extension if any other extension you are adding that you will get it in uh your uh automated window open to play right this we have already have seen a lot in uh like when you were uh when we were doing the automation through selenium so in there also lot like lots of people used to have this requirement that they want the extension to be preloaded in their automated browser window so same you can have it in playright as well I hope you find this tutorial useful do let me know if you have any thoughts any recommendation thank you thank you so much please like this video And subscribe to the channel also check out these awesome informative videos and keep watching more videos on selector sub Channel thank you
Info
Channel: SelectorsHub
Views: 1,674
Rating: undefined out of 5
Keywords: playwright, chromeplugin, chromeextension, playwright with chrome extension, playwright with chrome plugin, how to open browser with plugin in playwright, selectorshub, selectorshub playwright, ai, chatgpt, soar
Id: eGSbe9YeDMI
Channel Id: undefined
Length: 5min 2sec (302 seconds)
Published: Sun Feb 18 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.