Playwright is a library used for creating and controlling browser instances (Chrome, Firefox, Edge or Safari) for the purpose of test automation. Other similar libraries include Puppeteer (which only supports Chrome) and Selenium (which has been around much longer). All of these libraries are similar and have the same fundamental advantages and disadvantages.
These libraries work by creating a browser instance and then allowing you to send commands to the browser. These commands include navigating to a URL, clicking an element, querying for information on a webpage, typing text, etc. One advantage over plain JavaScript is that the Event.isTrusted
property is set to true for any events generated. This avoids that very trivial detection method.
There are, however, other ways to detect automation from these libraries. This includes a numerous list of JavaScript APIs that are modified in the browser instance, User-Agent strings, and the existence of extra global JavaScript variables created by the libraries for their functionality. For that reason, there are packages like playwright-stealth, puppeteer-extra-plugin-stealth and selenium-stealth, which attempt to hide these discrepancies from normal browsers. However, these packages are not perfect at hiding the numerous differences and are not necessarily kept up to date. AutoHotkey is an automation scripting language for Windows capable of automating many operating system tasks like keyboard and mouse actions. It is very powerful and can be used for a variety of tasks, including web automation. All you need is to use a normal browser and create an AutoHotkey script capable of interacting with the web content through keyboard and mouse commands. While AutoHotkey is not purpose-built for web automation, it's possible to query for the browser window position and size, take a screenshot, then use This is notably less convenient than using JavaScript or a purpose-built web automation library because you can't directly query for elements, but it has the advantage of not being nearly as detectable by the website. It uses the same browser as a normal user, and the There are many ways to automate web tasks, and each has its own advantages and disadvantages. JavaScript is the easiest to get started with, but is also the most detectable. Playwright/Puppeteer/Selenium are more difficult to get started with, but are slightly less detectable, especially with precautions. AutoHotkey is the most difficult to get started with, but is the least detectable with only mouse and keyboard interactions to monitor. In general, I would recommend JavaScript for most tasks like userscripts for improving website functionality while you're using it. For actual testing of your own websites or automation on websites that don't employ bot detection, Playwright/Puppeteer/Selenium are good options because of their convenience and programming language bindings, which are useful for actually processing the data from the automation. For automation on websites that employ bot detection, AutoHotkey is the best option because of its low detectability when the correct precautions are taken.AutoHotkey
ImageSearch
to look for coordinates of a particular part of the page. This gives you the ability to interact with elements on the page given how they look.Event.isTrusted
value is true because as far as the browser is concerned, the user is performing the actions. The only way to detect this is to observe mouse movements or typing speed to determine if a bot is performing the actions, but this can also be mitigated by slightly randomizing movements and timing and making typing speed more realistic.Conclusion