New in Playwright end-to-end testing: detect & close unpredictable overlays with "addLocatorHandler"

  Рет қаралды 1,642

Checkly

Checkly

Күн бұрын

Discover the latest feature of Playwright 1.42 - `page.addLocatorHandler`.
If you're tired of randomly appearing cookie banners breaking your end-to-end tests or want to automatically close all these intercom widgets, this method is right up your alley. With `addLocatorHandler`, handling elements that randomly pop up becomes a breeze!
In the video, we'll show you how the new Playwright method works in practice and why it makes end-to-end testing and synthetic monitoring so much easier.
0:00 Intro
0:35 The problem of unpredictable elements
1:16 Playwright UI mode
1:55 Cookie banner example
2:39 Close cookie banner with try/catch
3:44 try/catch problems
5:31 addLocatorHandler intro
6:29 addLocatorHandler in UI mode
7:43 addLocatorHandler details
9:35 Outro
Playwright Docs: playwright.dev/docs/api/class...
Checkly Synthetic Monitoring: www.checklyhq.com/product/syn...
Checkly Community: www.checklyhq.com/slack/
#playwright #testing #monitoring

Пікірлер: 26
@dva_kompota
@dva_kompota 15 күн бұрын
Cool new feature and great explanation - thank you! Love Playwright 😇
@connorginty
@connorginty 4 ай бұрын
This is exactly what I needed for my tests! I’m so excited to implement this.
@ChecklyHQ
@ChecklyHQ 4 ай бұрын
Right? I've been waiting for a general solution to the "whenever it appears" problem, too. 🎉
@foundresstt
@foundresstt 3 ай бұрын
Thank you so much! It has solved our pain 🤩
@ChecklyHQ
@ChecklyHQ 3 ай бұрын
Yay - happy to hear that!
@MaheshJoshi_wellington
@MaheshJoshi_wellington 4 ай бұрын
Wow your every video on playwright is awesome !
@ChecklyHQ
@ChecklyHQ 4 ай бұрын
Thank you so much! Happy the videos have been valuable. 😊
@emnznlg
@emnznlg 4 ай бұрын
Great content! Thank you very much.
@ChecklyHQ
@ChecklyHQ 4 ай бұрын
Thank you! Great it's been valuable! 😊
@theillo4739
@theillo4739 4 ай бұрын
Woooha, thanks for your content !
@ChecklyHQ
@ChecklyHQ 4 ай бұрын
Thank you for watching! 😉
@harshasuraweera
@harshasuraweera 4 ай бұрын
Thanks for the valuable content!
@ChecklyHQ
@ChecklyHQ 4 ай бұрын
Happy to! 😊
@powertester5596
@powertester5596 4 ай бұрын
Good stuff. Thanks for another useful video :-).
@ChecklyHQ
@ChecklyHQ 4 ай бұрын
Thank you! Happy the videos are valuable. 😊
@Muhammad55597
@Muhammad55597 4 ай бұрын
that's awesome, playwirght is the best
@ChecklyHQ
@ChecklyHQ 4 ай бұрын
Totally agreed. 🫣 It gets better with every release. 💪
@kowshikkumar9868
@kowshikkumar9868 4 ай бұрын
@checkly what if we have multiple pop-up in our flow. do we need to write addLocatorHandler for each pop-up. Ex: One pop-up having text "give feedback", second pop-up having test "rate-us"
@connorginty
@connorginty 4 ай бұрын
Based on my understanding from the docs, if each pop-up can be located with some kind of general selector or custom attribute for all pop-ups, one handler with some conditions should be enough for both cases.
@ChecklyHQ
@ChecklyHQ 4 ай бұрын
I haven't tested it but I think it depends. Either you can have multiple `addLocatorHandler` or you generalize the popups to all have the same id or something. Both approaches should work, but generalizing might not always be possible. :) Hope this helps!
@foundresstt
@foundresstt 3 ай бұрын
I've started to implement this approach in the project to catch random error alerts(but the problem is there can be more than 1 on the page simultaneously). So, probably can you give an idea if it is possible to catch 2+ elements of similar kind? For now I've resolved by catching the first() element. But all - would be much better ))
@ChecklyHQ
@ChecklyHQ 3 ай бұрын
Hmm, this is a great question that I don't have an answer to right now. But I'll put it on "the investigation list" and there might be a future video about it. :)
@foundresstt
@foundresstt 3 ай бұрын
@@ChecklyHQ Many thanks! Will keep an eye on your posts ))
@abdulwahabshariff894
@abdulwahabshariff894 4 ай бұрын
Instead of using in individual test, can we use this method in before All/before each or set a listener using page.on and implement this method inside the listener?
@ChecklyHQ
@ChecklyHQ 4 ай бұрын
Re: "can we use this method in before All/before each" - I didn't test it but this should work. Re: event listener - I'm not sure. Which event listener do you want to use?
@foundresstt
@foundresstt 3 ай бұрын
Yes, It works in beforeEach
How to run your Playwright end-to-end tests in SloMo
5:39
Checkly
Рет қаралды 2,5 М.
Sigma Kid Hair #funny #sigma #comedy
00:33
CRAZY GREAPA
Рет қаралды 35 МЛН
What it feels like cleaning up after a toddler.
00:40
Daniel LaBelle
Рет қаралды 78 МЛН
Useful gadget for styling hair 🤩💖 #gadgets #hairstyle
00:20
FLIP FLOP Hacks
Рет қаралды 6 МЛН
Mom's Unique Approach to Teaching Kids Hygiene #shorts
00:16
Fabiosa Stories
Рет қаралды 31 МЛН
Why "page.goto()" is slowing down your tests
8:55
Checkly
Рет қаралды 2,7 М.
14 Tools I Use to Build Websites with NextJS
9:22
Arif Logs
Рет қаралды 983
Add accessibility checks to your Playwright end-to-end tests
11:18
How to test and monitor your APIs with Playwright
9:51
Checkly
Рет қаралды 3,1 М.
Brutally honest advice for new .NET Web Developers
7:19
Ed Andersen
Рет қаралды 104 М.
The Story of Next.js
12:13
uidotdev
Рет қаралды 557 М.
iPhone 15 Pro Max vs IPhone Xs Max  troll face speed test
0:33
Ноутбук за 20\40\60 тысяч рублей
42:36
Ремонтяш
Рет қаралды 352 М.
iPhone 15 Pro в реальной жизни
24:07
HUDAKOV
Рет қаралды 452 М.
Look, this is the 97th generation of the phone?
0:13
Edcers
Рет қаралды 6 МЛН
Самые крутые школьные гаджеты
0:49