Examples close PDF print previews or new instances of browser using xk6-browser

I was thinking to use xk6 to my performance tests in my web application but I didn’t find any example or docs about how to close for example PDF print previews or if the PDF is opened in another tab or instance of browser, how can I switch to them and close it to continue doing another actions

There is an example here for example of print preview:
W3Schools Tryit Editor when you clik in the button Print this page this open a PDF preview … how can I close that print preview using xk6

And the other scenario is pressing a button this opens other instance of the browser with a PFD or HTLM how can I swith to this in order to do some validations and also close it after finishing

Hi @RetlaW,

Welcome to the forum!

Unfortunately we don’t currently support working with the print preview dialog box. I’ve opened an issue (#828) so that you can track it, although we’re not sure when we will get to this.

If a new tab is opened when a link is clicked on, it is possible to retrieve a list of all pages from the current browserContext. With that list of pages, you should be able to find page and assert something, and finally close that new tab. Unfortunately I’ve not been able to test this as we’ve found that navigation is broken when a link is clicked on that opens in a new tab (issue #827).

Sorry about this, but thanks for raising the question!

Cheers,
Ankur

Thank you I will track both issues that will help me with my Load Testing in my current project :slight_smile: