You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## 🚀 What's New in v1.5.0 - Professional Snapshots & Downloads
68
68
69
-
This update introduces critical flexibility for Chromium engine initialization, allowing developers to pass command-line arguments directly to the browser.
69
+
This major update introduces professional-grade snapshot tools using the DevTools Protocol, enhanced download management, and native HTTP status tracking for precise automation.
70
70
71
71
### ⚡ Key Features & Enhancements
72
72
73
-
#### **1. Command-Line Argument Support**
73
+
#### **1. Proactive Snapshot Engine**
74
74
75
-
The new `AdditionalBrowserArguments` property allows you to configure the Chromium engine with specialized switches before it starts. This is essential for advanced automation, proxy configuration, and performance tuning.
75
+
The new `CaptureSnapshot(cdpParameters)` method provides direct access to the `Page.captureSnapshot` CDP method. This allows you to capture MHTML snapshots or other CDP-supported formats directly as strings.
76
76
77
-
-**Pre-Initialization:** These arguments are applied during the environment creation phase. You must set this property **before** calling `.Initialize()`.
78
-
-**Powerful Switches:** Support for many Chromium flags, including:
79
-
-`--disable-gpu`: Disables hardware acceleration (useful for legacy hardware or headless snapshots).
80
-
-`--mute-audio`: Starts the browser in complete silence.
81
-
-`--proxy-server="http://1.2.3.4:8080"`: Forces all traffic through a specific proxy.
82
-
-`--incognito`: Starts in private browsing mode.
83
-
-`--user-agent="..."`: A secondary way to override the default identity.
77
+
-**Unified Method:**`ExportPageData` has been consolidated into `CaptureSnapshot` for a cleaner API.
78
+
-**PascalCase Compliance:** Promoted internal `captureSnapshot` to a public, standard-compliant `CaptureSnapshot` method.
79
+
-**Event Consistency:** Correctly wired up `OnZoomChanged` to the browser engine's zoom events.
The `NetJson.Parser` has received a massive feature upgrade to support production-grade data manipulation directly from AutoIt.
83
+
You now have full control over the browser's download lifecycle.
88
84
89
-
-**Smart Typing & Deep Creation:**`SetTokenValue` now automatically creates missing parent objects and intelligently detects data types (Boolean, Null, Numbers) while preserving leading zeros in identifiers.
90
-
-**Data Querying:** New `GetTokenCount` and `GetKeys` methods allow for deep inspection of JSON structures without manual parsing.
91
-
-**Array Power Tools:** Built-in `SortArray` and `SelectUnique` (deduplication) leverage native LINQ performance to manage large data sets in memory.
85
+
-**Automated Routing:** Use `SetDownloadPath(path)` to force all downloads into a specific folder or file. If a path points to an existing directory, the library intelligently appends the suggested filename.
86
+
-**UI Control:** Toggle the browser's download shelf visibility using the `IsDownloadUIEnabled` property.
87
+
-**Clean Event Contract**: The `OnDownloadStarting` event has been simplified to provide core metadata (URI, DefaultPath). Programmatic overrides now use the new `SetDownloadPath` and `IsDownloadHandled` properties/methods, ensuring 100% reliable path redirection from AutoIt, bypassing legacy COM `ByRef` limitations.
88
+
-**Manual Mode Bypass**: Setting `IsDownloadHandled = True` during the `OnDownloadStarting` event will now immediately cancel the Edge download engine (`e.Cancel = true`). This allows AutoIt to handle the download externally (e.g., via `InetGet`) using its own logic. Active downloads can be monitored via `ActiveDownloadsList` and cancelled via `CancelDownloads()`
89
+
-**IsZoomControlEnabled**: New property to enable/disable the built-in zoom mechanism (Ctrl+Wheel, etc.).
90
+
-**UnLockWebView Method**: Added `UnLockWebView()` to re-enable restricted features previously disabled by `LockWebView()`.
92
91
93
-
#### **3. Advanced Export & PDF Management**
92
+
#### **3. Native HTTP Status Tracking & Deadlock Prevention**
94
93
95
-
-**ExportPageData(format, filePath):** Automate saving pages as HTML or MHTML (Single File) without dialogs.
96
-
-**PrintToPdfStream():** Capture the page as a PDF and retrieve it as a Base64 string directly in AutoIt—no temporary files needed.
97
-
-**HiddenPdfToolbarItems:** Take full control of the PDF viewer toolbar by hiding specific buttons (Save, Print, Search, etc.) through bitwise flags.
94
+
Track server responses with precision using the new `OnWebResourceResponseReceived` event. This is essential for detecting link rot (404s), server errors (500s), or validating API response responses directly from AutoIt. It provides the status code, reason phrase, and the original request URL.
98
95
96
+
-**Deadlock Shield:** By default, this event now only triggers for the main document (`HttpStatusCodeDocumentOnly = True`). This prevents the event flood (e.g., hundreds of 404s for missing icons or scripts) that previously caused AutoIt's GUI to deadlock.
97
+
-**Granular Control:** Use `HttpStatusCodeEventsEnabled` to toggle the event entirely or disable the filter for deep resource auditing.
99
98
100
-
---
99
+
#### **4. Memory-Based Binary Support**
100
+
101
+
The new `DecodeB64ToBinary(base64Text)` method decodes Base64 data directly into a raw byte array. This is perfect for high-speed processing of images or PDFs entirely in memory.
102
+
103
+
and a `CapturePreviewAsBase64(format)` method to Captures a screenshot of the current page content and returns it as a Base64-encoded data URL
## 📖 NetWebView2Lib Version 1.4.3 - (2026-01-20) (Quick Reference)
109
+
## 📖 NetWebView2Lib Version 1.5.0 - (Quick Reference)
110
+
106
111
107
112
### NetWebView2Lib (ProgId: NetWebView2.Manager)
108
113
@@ -164,6 +169,30 @@ Sets additional command-line arguments to be passed to the Chromium engine durin
164
169
Controls the visibility of buttons in the PDF viewer toolbar using a bitwise combination of CoreWebView2PdfToolbarItems (e.g., 1=Save, 2=Print, 4=Search).
165
170
`object.HiddenPdfToolbarItems[ = Value]`
166
171
172
+
##### IsDownloadUIEnabled
173
+
Determines whether the browser's default download UI (shelf/bubble) is shown.
174
+
`object.IsDownloadUIEnabled[ = Value]`
175
+
176
+
##### HttpStatusCodeEventsEnabled
177
+
Enables or disables the `OnWebResourceResponseReceived` event entirely.
178
+
`object.HttpStatusCodeEventsEnabled[ = Value]`
179
+
180
+
##### HttpStatusCodeDocumentOnly
181
+
Determines whether `OnWebResourceResponseReceived` triggers for all resources (False) or only for the main document (True). Essential for preventing GUI deadlocks in AutoIt.
182
+
`object.HttpStatusCodeDocumentOnly[ = Value]`
183
+
184
+
##### IsDownloadHandled
185
+
Determines whether the download is handled by the application. If set to **True** during `OnDownloadStarting`, the internal Edge download is cancelled.
186
+
`object.IsDownloadHandled[ = Value]`
187
+
188
+
##### ActiveDownloadsList
189
+
Returns a pipe-separated string of all active download URIs.
190
+
`object.ActiveDownloadsList`
191
+
192
+
##### IsZoomControlEnabled
193
+
Determines whether user can zoom the page (Ctrl+MouseWheel, shortcuts).
194
+
`object.IsZoomControlEnabled[ = Value]`
195
+
167
196
#### Method
168
197
169
198
##### Initialize
@@ -208,9 +237,13 @@ Toggles between Native (true) and Custom (false) context menu modes.
208
237
`object.SetContextMenuEnabled(Enabled As Boolean)`
209
238
210
239
##### LockWebView
211
-
Locks down the WebView by disabling DevTools, Context Menus, and Zoom.
240
+
Locks down the WebView by disabling context menus, dev tools, zoom control, and default error pages.
212
241
`object.LockWebView()`
213
242
243
+
##### UnLockWebView
244
+
Re-enables the features previously restricted by `LockWebView()`.
245
+
`object.UnLockWebView()`
246
+
214
247
##### DisableBrowserFeatures
215
248
Disables major browser features for a controlled environment.
216
249
`object.DisableBrowserFeatures()`
@@ -381,9 +414,13 @@ Encodes a string to Base64 (UTF-8).
381
414
`object.EncodeB64(Value As String)`
382
415
383
416
##### DecodeB64
384
-
Decodes a Base64 string back to plain text.
417
+
Decodes a Base64 string back to **plain text** (UTF-8).
385
418
`object.DecodeB64(Value As String)`
386
419
420
+
##### DecodeB64ToBinary
421
+
Decodes a Base64 string directly into a **raw byte array**. Optimized for memory-based binary processing (e.g., images, PDFs).
422
+
`object.DecodeB64ToBinary(Base64Text As String)`
423
+
387
424
##### SetZoomFactor
388
425
Sets the zoom factor for the control.
389
426
`object.SetZoomFactor(Factor As Double)`
@@ -428,8 +465,20 @@ Clears the browser cache (DiskCache and LocalStorage).
428
465
Asynchronously retrieves the entire visible text content of the document (sent via OnMessageReceived with 'Inner_Text|').
429
466
`object.GetInnerText()`
430
467
468
+
##### CaptureSnapshot
469
+
Captures page data using Chrome DevTools Protocol. Can return MHTML or other CDP formats based on the `cdpParameters` JSON string.
470
+
`object.CaptureSnapshot(CdpParameters As String)`
471
+
472
+
##### SetDownloadPath
473
+
Sets a global default folder or file path for all browser downloads. If a directory is provided, the filename is automatically appended by the library.
474
+
`object.SetDownloadPath(Path As String)`
475
+
476
+
##### CancelDownloads
477
+
Cancels active downloads. If `uri` is empty or omitted, cancels all active downloads.
478
+
`object.CancelDownloads([Uri As String])`
479
+
431
480
##### ExportPageData
432
-
Exports the current page data as HTML (0) or MHTML (1). If FilePath is provided, it saves to disk; otherwise, it returns the content as a string.
481
+
[LEGACY] Consolidated into **CaptureSnapshot**.
433
482
`object.ExportPageData(Format As Integer, FilePath As String)`
434
483
435
484
##### PrintToPdfStream
@@ -442,6 +491,10 @@ Captures the current page as a PDF and returns the content as a Base64-encoded s
442
491
Fired when a message or notification is sent from the library to AutoIt.
443
492
`object_OnMessageReceived(Message As String)`
444
493
494
+
##### OnWebResourceResponseReceived
495
+
Fired when a web resource response is received (useful for tracking HTTP Status Codes).
496
+
`object_OnWebResourceResponseReceived(StatusCode As Integer, ReasonPhrase As String, RequestUrl As String)`
497
+
445
498
##### OnNavigationStarting
446
499
Fired when the browser starts navigating to a new URL.
447
500
`object_OnNavigationStarting(Url As String)`
@@ -477,6 +530,14 @@ Fired when the browser loses focus.
477
530
##### OnContextMenuRequested
478
531
Fired when a context menu is requested (Simplified for AutoIt).
479
532
`object_OnContextMenuRequested(LinkUrl As String, X As Integer, Y As Integer, SelectionText As String)`
533
+
534
+
##### OnDownloadStarting
535
+
Fired when a download is starting. Provides core metadata to allow decision making. Path overrides and UI suppression should be handled via the `DownloadResultPath` and `IsDownloadHandled` properties.
536
+
`object_OnDownloadStarting(Uri As String, DefaultPath As String)`
537
+
538
+
##### OnDownloadStateChanged
539
+
Fired when a download state changes (e.g., Progress, Completed, Failed).
540
+
`object_OnDownloadStateChanged(State As String, Uri As String, TotalBytes As Long, ReceivedBytes As Long)`
480
541
481
542
482
543
---
@@ -582,7 +643,7 @@ Encodes a string to Base64 (UTF-8).
582
643
`string EncodeB64(PlainText As String)`
583
644
584
645
##### DecodeB64
585
-
Decodes a Base64 string back to plain text.
646
+
Decodes a Base64 string back to **plain text** (UTF-8).
0 commit comments