Adding a short cut key combination to a web application or web site can be quite powerful. When the short cut key combination is activated — things can happen. Things that you have defined on top of everything the web application already offers. In this article I describe how I have used Playwright to inject a short cut key combination into a web site. This hotkey — activated by simply pressing ctrl+b — runs a function that downloads all images in the current browser context to the local file system. The function that is executed is a Node (JS) function that can on the one hand access the complete browser context (including DOM, JavaScript context, local storage, cookies etc) and on the other hand has all of Node and NPM at its disposal. A pretty powerful combination.

This article is just an example of how you can rich functionality to your SaaS web applications, favorite blogs, cloud consoles and anything you run in a browser. By running the browser through Playwright, you get the normal browser functionality as well as the world of Node through the wrapper and bridge that Playwright provides. I have introduced Playwright in an  earlier article and if you do not know Playwright yet, I strongly suggest you read that article.

In short: Playwright is an open source software library that gives us a _deus in machina — _a robot in our browser do perform power operations. This opens up opportunities from automated testing to tactical integration and RPA (Robotic Process Automation), and from deeplink bookmarks, screen scraping, web app health monitoring (smoketests) and customized web applications. Playwright is a fairly new (2020), open-source, JavaScript-based, cross-browser automation library for end-to-end testing.

#programming #javascript #nodejs

Use Playwright To Inject Data Into Any Web Page
9.25 GEEK