We just implemented the thread local in our playwright script. We were able to launch the browser in parallel but getting null pointer exception in browse.close. Also unable to perform same operation in azure pipeline.
@@naveenautomationlabs thank you Naveen. Playwright is quite in demand and noone has such good content as you do till now. I am refering your cucumber series and replacing selenium with playwright for creating a framework at my work. Eagerly waiting for your upcoming videos and your tips. Thanx again for always guiding us.
After this can you please do a video of how to set up listeners, extent reports, and take screen shorts. in GitHub I saw code sir, I want to know how you have done from scratch after the Login page in the POM model framework. Thank you so much for creating videos, These are very useful for all Automation engineers sir.
This is exactly how I have implemented in my current project. Have a question here. Why should we have Playwright as static ThreadLocal? Just static should also work, right? Its like for my complete suite, am using single Playwright static object. So we just implement ThreadLocal on Browser, BrowserContext, Page for each test case and reuse same Playwright object. That should work, right? That way, serial execution is working fine but parallel is failing. Any idea why that’s so?
Static creates a common copy of playwright for all the objects. Parallel execution wont work with static playwright. Better you make playwright with static threadlocal.
@@naveenautomationlabs Every BrowserContext created by Playwright is a new Window without any session data, right? So, logically it should work, isn’t it?
Hi I wanted to understand why we need to implement thread local if there is no test data dependency. I mean in this framework each class creates its own playwright object so if i run 20 classes in parallel they will have their own playwright or browser objects right ? Please explain more on this as I am a little confused
Hi Thanks Naveen for all those, I am a new to start, could you please any one help me. how to use auto login in the pom if more than 2 pages and tests with threadlocal. However in the most of the samples and video only explained 2pages alone .. So please help anyone and appreciate in an advance!!!
Hi Naveen , I want to run parallel execution using same browser. In the testng file I have configured as "" ,so 2 browsers get launched, but one of them gets closed and gives error message as " com.microsoft.playwright.PlaywrightException: Object doesn't exist: handle@dc6f831c1ddfdf763239053172c24222" . Can you help with any ref why this error is displayed??
how do I set default timeout with threadlocal browser context? I used to set with browserContext.setDefaultTimeout(60000) but with threadlocal, where should I define it? @naveenautomationlabs
Thanks a lot..all your tutorials are very useful ..Eagerly Waiting for the next episode....
Thanks for creating video on ThreadLocal concept .. Very Useful !
We just implemented the thread local in our playwright script. We were able to launch the browser in parallel but getting null pointer exception in browse.close. Also unable to perform same operation in azure pipeline.
Please make a video on the same thread local with Java.
ThreadLocal variables are declared static but they are re-initialzed every time in the initialize method. So it defies the use of static
Yes it needs to be reinitialized with every thread so that each thread will get the local copy of context.
@naveenautomationlabs could you please share the video link where thread local concept implemented in selenium framework
Thanks you so much.
Threads are not closed thus may cause memory leaks,moreover due to wrong implementation the screenshots are not getting attached to allure report
Hey Naveen, Don't we need to make the get methods synchronized? getPage, getBrowserContext, getBrowser
Yes we can make it synchronized. But not needed, TL will alwys return the local copy of instance.
@@naveenautomationlabs thank you Naveen. Playwright is quite in demand and noone has such good content as you do till now. I am refering your cucumber series and replacing selenium with playwright for creating a framework at my work. Eagerly waiting for your upcoming videos and your tips. Thanx again for always guiding us.
After this can you please do a video of how to set up listeners, extent reports, and take screen shorts. in GitHub I saw code sir, I want to know how you have done from scratch after the Login page in the POM model framework. Thank you so much for creating videos, These are very useful for all Automation engineers sir.
This is exactly how I have implemented in my current project. Have a question here.
Why should we have Playwright as static ThreadLocal? Just static should also work, right?
Its like for my complete suite, am using single Playwright static object.
So we just implement ThreadLocal on Browser, BrowserContext, Page for each test case and reuse same Playwright object. That should work, right?
That way, serial execution is working fine but parallel is failing. Any idea why that’s so?
Static creates a common copy of playwright for all the objects. Parallel execution wont work with static playwright. Better you make playwright with static threadlocal.
@@naveenautomationlabs Every BrowserContext created by Playwright is a new Window without any session data, right? So, logically it should work, isn’t it?
Hi
I wanted to understand why we need to implement thread local if there is no test data dependency.
I mean in this framework each class creates its own playwright object so if i run 20 classes in parallel they will have their own playwright or browser objects right ?
Please explain more on this as I am a little confused
yep, in this case you are right, each test class will create its own playwright object so basically there is no need for threadlocal here
@naveen seems like your telegram group is deactivated. Please share the updated invite link
Hi Thanks Naveen for all those, I am a new to start, could you please any one help me. how to use auto login in the pom if more than 2 pages and tests with threadlocal.
However in the most of the samples and video only explained 2pages alone ..
So please help anyone and appreciate in an advance!!!
Hi Naveen , I want to run parallel execution using same browser. In the testng file I have configured as "" ,so 2 browsers get launched, but one of them gets closed and gives error message as " com.microsoft.playwright.PlaywrightException: Object doesn't exist: handle@dc6f831c1ddfdf763239053172c24222" . Can you help with any ref why this error is displayed??
Hey, I have been getting the same error and even I'm not sure how to resolve this.
Naveen, Can you please help us out there? We would be thankful..
Also, @saurabhsrivastav902 please let me know if you got the resolution for this.
not able to understand even little . Someone please help this one with some other video.
You need to improve your java knowledge first to learn these concepts.
@@naveenautomationlabs Core i know but still what should i do ? Shall i watch again or you would help me with some more related video or tutorial
If you know java 8 features then you should be able to understand this basic concepts as well.
how do I set default timeout with threadlocal browser context? I used to set with browserContext.setDefaultTimeout(60000) but with threadlocal, where should I define it? @naveenautomationlabs