Jump to content

Recommended Posts

Posted (edited)

Hi everyone,

After months of development, testing, and refinement, I’m excited to share something new with the AutoIt community:

AutoIt CDP UDF

A modern, high‑performance automation library for controlling Chromium‑based browsers directly through the Chrome DevTools Protocol (CDP) — with a clean, Playwright‑inspired API.

This UDF communicates with the browser directly over WebSockets, with no WebDriver, no Selenium, no ChromeDriver, no Node.js, and no external dependencies.

If you’ve ever used Playwright or Puppeteer, the API will feel instantly familiar — but now it’s native AutoIt.

Why CDP? Why this UDF?

CDP gives you direct, low‑level control over Chromium. That means:

  • No WebDriver overhead

  • No Selenium flakiness

  • No external processes

  • No drivers to match versions

  • No Python/Node/npm stack

  • No installation required

Just AutoIt + Chrome (CDP).

This UDF aims to bring a modern, fluent, reliable automation experience to AutoIt — something closer to Playwright than to traditional WebDriver UDFs.

🔥 Key Features

  • Direct CDP communication (no WebDriver, no Selenium)

  • Playwright‑inspired API (locators, assertions, steps, test object)

  • Extremely fast (no driver layer, no IPC overhead)

  • Extremely lightweight (no external runtimes required)

  • Auto‑waiting for elements and conditions (planned)

  • Built‑in assertion system (expect())

  • Object‑driven, test‑aware scripting

  • Event‑driven architecture

  • Network request/response interception (planned)

  • JavaScript evaluation (planned)

  • Automatic browser download via Selenium Manager

  • Portable, dependency‑free executables that run on any Windows machine

Works with Chrome, Edge, Brave, Chromium — (currently only Chrome is fully supported)

🧪 Playwright‑Style Test Output

Here’s a real output from the included “Basic Web Page” test:

▶ Test: Basic web page test
  ▶ Step: Verify Basic Web Page navigation
    ▶ Step: Navigate to evil tester test pages
    ▶ Step: Verify the main page
        ✓ Expect: expected [Software Testing Practice Pages, Apps, and Challenges] and got [Software Testing Practice Pages, Apps, and Challenges] (line 29)
        ✓ Expect: expected [Software Testing Practice Pages, Apps, and Challenges] and got [Software Testing Practice Pages, Apps, and Challenges] (line 31)
        ✓ Expect: object [-5136690175131552945.1.1] is hidden (line 32)
        ✓ Expect: expected [False] and got [False] (line 33)
        ✓ Expect: expected [True] and got [True] (line 34)
    ▶ Step: Verify navigation to Pages
        ✓ Expect: expected [Pages] and got [Pages] (line 39)
        ✓ Expect: object [-5136690175131552945.1.2] is visible (line 40)
        ✓ Expect: expected truthy and got [True] (line 41)
        ✓ Expect: expected falsy and got [False] (line 42)
    ▶ Step: Navigate to Pages
    ▶ Step: Verify navigation to Basics
        ✓ Expect: expected [Basics] and got [Basics] (line 50)
    ▶ Step: Navigate to Basic Web Page
  ▶ Step: Verify Basic Web Page
    ▶ Step: Page elements
        ✓ Expect: actual text contains [Elements] (line 63)
        ✓ Expect: expected [Tags:

 Elements Locators

Categories:

 Basics] to contain [Elements] (line 64)
        ✓ Expect: expected [Tags:

 Elements Locators

Categories:

 Basics] to match regex [.*Categor.*] (line 65)
        ✓ Expect: expected [A paragraph of text] and got [A paragraph of text] (line 66)
        ✓ Expect: expected [Another paragraph of text] and got [Another paragraph of text] (line 67)
    ▶ Step: Click Me functionality
        ✓ Expect: expected [You clicked the button!] and got [You clicked the button!] (line 72)
        ✓ Expect: expected defined value and got [defined] (line 73)
        ✓ Expect: expected length [23] and got [23] (line 74)
  ▶ Step: Verify invalid locator
      ✓ Expect: expected Null and got [Null] (line 80)

> BasicWebPageWithStandardBrowser() took n ms.

📦 Included Examples

The repo includes a full suite of example scripts:

  • Basic Web Page test

  • Headless mode

  • Auto‑installed Chrome v119

  • Playwright Chromium

  • Element attributes

  • Multiple elements

  • Basic inputs

  • Number inputs

These examples demonstrate the API, locators, assertions, and CDP interactions.

📥 Download & GitHub Repository

You can find the full source, examples, documentation, and comparison tables here:

👉 https://github.com/seanhaydongriffin/autoit-cdp-udf

🛠️ Requirements

  • AutoIt v3.3.16.0+

  • AutoItObject UDF (already included)

  • JsonC UDF (already included)

  • Chrome with remote debugging enabled

🎉 Final Thoughts

This UDF is still evolving — but it already provides a fast, modern, CDP‑native automation experience that AutoIt has never had before.

If you’re interested in:

  • modern browser automation

  • Playwright‑style scripting

  • CDP exploration

  • building a new generation of AutoIt test tools

…then I’d love your feedback and ideas.

Edited by seangriffin
simplify the title

Cheers, Sean.

See my other UDFs:

Chrome UDF - Automate Chrome | SAP UDF - Automate SAP | Java UDF - Automate Java Applications & Applets | Tesseract (OCR) UDF - Capture text from applications, controls and the desktop | Textract (OCR) UDF - Capture text from applications and controls | FileSystemMonitor UDF - File, Folder, Drive and Shell Monitoring | VLC (Media Player) UDF - Creating and controlling a VLC control in AutoIT | Google Maps UDF - Creating and controlling Google Maps (inc. GE) in AutoIT | SAPIListBox (Speech Recognition) UDF - Speech Recognition via the Microsoft Speech (SAPI) ListBox | eBay UDF - Automate eBay using the eBay API | ChildProc (Parallel Processing) UDF - Parallel processing functions for AutoIT | HyperCam (Screen Recording) UDF - Automate the HyperCam screen recorder | Twitter UDF - Automate Twitter using OAuth and the Twitter API | cURL UDF - a UDF for transferring data with URL syntax

See my other Tools:

Rapid Menu Writer - Add menus to DVDs in seconds | TV Player - Automates the process of playing videos on an external TV / Monitor | Rapid Video Converter - A tool for resizing and reformatting videos | [topic130531]Rapid DVD Creator - Convert videos to DVD fast and for free | ZapPF - A tool for killing processes and recycling files | Sean's eBay Bargain Hunter - Find last minute bargains in eBay using AutoIT | Sean's GUI Inspector - A scripting tool for querying GUIs | TransLink Journey Planner with maps - Incorporating Google Maps into an Australian Journey Planner | Automate Qt and QWidgets | Brisbane City Council Event Viewer - See what's going on in Brisbane, Australia
Posted (edited)
...
Func _CDP_Browser_FullPath($sFullPath = Default)
    Local Static $sBrowser = "init", $iErr = 10, $iExt = 10
    If $sBrowser = "init" Or $sFullPath = "init" Then
        $iErr = 10
        $iExt = 1
        $sBrowser = @ProgramFilesDir & "\Google\Chrome\Application\chrome.exe"
        If Not FileGetSize($sBrowser) Then $sBrowser = @LocalAppDataDir & "\Google\Chrome\Application\chrome.exe"
        If Not FileGetSize($sBrowser) Then $sBrowser = ""
    EndIf
    If Not IsKeyword($sFullPath) And $sFullPath <> "" And $sFullPath <> "init" Then
        $iErr = 10
        $iExt = 2
        $sBrowser = $sFullPath
    EndIf
    If $iErr = 10 Then $iErr = Int(Not FileGetSize($sBrowser))
    Return SetError($iErr, $iExt, $sBrowser)
EndFunc   ;==>_CDP_Browser_FullPath


#Region --- Browser Class ---

Func _CDP_Browser_Launch($oSelf, $browser = Default, $port = Default, $startupSwitches = Default, $profile = Default, $windowSize = Default)

    If $cdp.config.infoPopups = True Then SplashTextOn("AutoIt CDP", "Preparing browser ...", 420, 120)

    If $browser = Default Then
        $browser = _CDP_Browser_FullPath($browser)
    EndIf
...

Thanks for sharing.

Edited by argumentum
better

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting  image.gif.922e3a93535f431de08b31ee669cc446.gif
autoit_scripter_blue_userbar.png

Posted

Thanks.

But this means next one to add to my Browser.au3 UDF

Oh boy.

;)

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

  • seangriffin changed the title to [UDF] AutoIt CDP UDF — A Modern, Playwright‑Style Chrome Automation Library

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...