Skip to content

Commit 9a15b1b

Browse files
authored
v2.0.0-stable
1 parent 24b9cac commit 9a15b1b

1 file changed

Lines changed: 123 additions & 36 deletions

File tree

README.md

Lines changed: 123 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,17 @@ https://www.autoitscript.com/forum/topic/213375-webview2autoit-autoit-webview2-c
2323
### 🛠 Prerequisites
2424

2525
1. **.NET Framework 4.8** or higher.
26-
2. **Microsoft Edge WebView2 Runtime**.
26+
2. **Microsoft Edge WebView2 Runtime version 128.0.2739.15 or higher**.
27+
28+
29+
https://github.com/ioa747/NetWebView2Lib/blob/Version-v2.0.0-stable-dev1/src/packages.config
30+
```
31+
<?xml version="1.0" encoding="utf-8"?>
32+
<packages>
33+
<package id="Microsoft.Web.WebView2" version="1.0.2739.15" targetFramework="net48" />
34+
<package id="Newtonsoft.Json" version="13.0.4" targetFramework="net48" />
35+
</packages>
36+
```
2737

2838
* *The registration script will check for this and provide a download link if missing.*
2939

@@ -62,54 +72,102 @@ This project is provided "as-is". You are free to use, modify, and distribute it
6272
<p align="center">
6373
<img src="https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png" width="100%">
6474
</p>
75+
## 🚀 What's New in v2.0.0-stable - Professional Naming & Absolute Stability
6576

66-
## 🚀 What's New in v2.0.0-beta.3 - AcceleratorKey Detail & Refactoring
67-
68-
This update focuses on deep keyboard interception and code modularity.
77+
This stable release marks the transition to a professional, standardized COM architecture and introduces high-performance infrastructure for production-grade applications.
6978

7079
### ⚡ Key Features & Enhancements
7180

72-
#### **1. PhysicalKeyStatus Expansion**
73-
The `OnAcceleratorKeyPressed` event now provides 1:1 access to the underlying Windows keyboard state.
74-
- **New Properties**: `RepeatCount`, `ScanCode`, `IsExtendedKey`, `IsMenuKeyDown`, `WasKeyDown`, and `IsKeyReleased`.
75-
- **Use Case**: Detect held keys, distinguish between left/right Alt/Ctrl, and implement complex hotkey logic without Win32 API calls.
81+
#### **1. COM Standardizing (NetWebView2Lib)**
82+
The library has transitioned to a consistent naming convention for all subsystems, improving discoverability and professional alignment.
83+
- **New ProgIDs**: `NetWebView2Lib.WebView2Manager`, `NetWebView2Lib.WebView2Bridge`, and `NetWebView2Lib.WebView2Parser`.
84+
- **Full Backward Compatibility**: Legacy ProgIDs (e.g., `NetWebView2.Manager`) continue to function via an inheritance-based compatibility layer.
7685

77-
#### **2. Performance & Modularity**
78-
- **Standalone Argument Logic**: Argument wrappers have been moved to dedicated files (e.g., `WebView2AcceleratorKeyPressedEventArgs.cs`).
79-
- **Lean Core**: Reduced `WebViewManager.cs` complexity by outsourcing event data structures.
86+
#### **2. Threading & Stability Mastery**
87+
Identified and resolved complex threading deadlocks in asynchronous handlers.
88+
- **UI-Thread Marshalling**: Explicit synchronization ensure that events like Context Menus, Downloads, and IFrame HTML extraction always safely interact with the AutoIt UI thread.
89+
- **SDK Resilience**: Reflection-based URI retrieval for IFrames ensures compatibility across different versions of the WebView2 SDK.
8090

81-
#### **3. Process Stability & Authentication**
82-
- **Robust Crash Handling**: `OnProcessFailed` provides deep insights into process crashes, allowing for automated recovery or logging.
83-
- **Crash Dump Management**: `FailureReportFolderPath` allows redirection of diagnostic files.
84-
- **Native Authentication**: `OnBasicAuthenticationRequested` brings support for server-level auth prompts, including asynchronous credential entry via the `.Complete()` method.
91+
#### **3. Standardized SDK Locking (v1.0.2739.15)**
92+
To ensure maximum reliability across the broadest possible range of Windows installations, we have standardized the core engine on a specific, high-stability SDK version.
93+
- **Fixed Version**: Locked to **WebView2 SDK 1.0.2739.15** (Released August 26, 2024).
94+
- **Runtime Requirement**: Requires **WebView2 Runtime 128.0.2739.15** or newer.
95+
- **Strategic Choice**: This version provides a "Sweet Spot" of features—including full support for IFrame scraping, Basic Authentication, and Process Failure events—while maintaining compatibility with the vast majority of current "Evergreen" browser installations.
96+
- **Strict Validation**: The registration utility (`Register_web2.au3`) has been updated to perform a mandatory check for this minimum runtime version, preventing obscure startup errors.
8597

86-
---
98+
#### **4. Enriched Verbose Logging**
99+
A redesigned diagnostic system for easier debugging of complex workflows.
100+
- **Branded & Traceable**: Every log line now includes the `+++[NetWebView2Lib]` prefix and the instance-specific `[HANDLE:0x...]`.
101+
- **Comprehensive Event Tracing**: Detailed logs for Navigation, Resource Requests (with HTTP codes), Focus changes, and Web Messages.
102+
- **Default Folder Sync**: Renamed the default crash folder to `FailureReportFolder` for better parity with internal WebView2 parameters.
87103

88-
## 🚀 What's New in v2.0.0-beta.2 - COM Versioning & Handle Alignment
104+
#### **4. High-Performance IFrame Scraping**
105+
Bulk extraction methods (`GetFrameUrls`, `GetFrameNames`) allow for high-speed metadata retrieval from complex multi-frame layouts, essential for advanced web scraping.
89106

90-
This update introduces the ability to query the DLL version directly and aligns window handles with AutoIt's native format.
107+
---
108+
#### 🖼️ IFrame HTML Extraction
91109

92-
### ⚡ Key Features & Enhancements
110+
We implemented a robust system to track and extract HTML from iframes, including cross-origin ones.
111+
112+
##### 1. Frame Tracking System
113+
114+
A dynamic registration system was added to 
115+
116+
WebView2Manager.cs to track the lifecycle of all iframes.
117+
118+
- **Initialization**: Automatically subscribes to `CoreWebView2.FrameCreated`.
119+
- **Lifecycle Management**: Tracks `CoreWebView2Frame` objects in a thread-safe list and automatically removes them on `Destroyed`.
120+
121+
##### 2. New IFrame API
122+
123+
Six new COM methods were added to the 
124+
125+
IWebViewActions interface (Standardized & Compatibility Layers):
126+
127+
|Method|Description|
128+
|---|---|
129+
|GetFrameCount()|Returns the number of tracked iframes.|
130+
|GetFrameUrl(index)|Returns the URL of a specific iframe.|
131+
|GetFrameName(index)|Returns the Name of a specific iframe.|
132+
|GetFrameUrls()|Returns the **entire array** of frame URLs as a pipe-separated string.|
133+
|GetFrameNames()|Returns the **entire array** of frame names as a pipe-separated string.|
134+
|GetFrameHtmlSource(index)|Asynchronously initiates HTML extraction for a frame.|
135+
136+
#### 🩺Verbose Diagnostic Mode
93137

94-
#### **1. Advanced Handle Formatting (`[HANDLE:0x...]`)**
95-
All window handles returned by the library (via properties or events) are now formatted as strings compatible with AutoIt's Advanced Window Descriptions.
96-
- **Direct Compatibility**: Handles like `[HANDLE:0x00010203]` can be passed directly to `WinExists`, `WinSetTitle`, etc., without `HWnd()` conversion.
138+
A new `Verbose` property was added to allow real-time diagnostic logging to the SciTE console (or any stdout listener).
139+
140+
```autoit
141+
$oWebV2M.Verbose = True ; Enable diagnostic logging
142+
```
143+
144+
When enabled, the console will show entries like: 
145+
`[NetWebView2Lib][14:20:33.456] Initialize request: parent=[HANDLE:0x...], x=0, y=0, w=1024, h=768` 
146+
`[NetWebView2Lib][14:20:34.123] WebView2 Initialized successfully.` 
147+
`[NetWebView2Lib][14:20:35.789] Navigate: https://www.google.com`
148+
149+
#### 🔄 Backward Compatibility (Legacy ProgIDs)
150+
151+
To ensure stability for existing scripts not using the UDF, the following legacy ProgIDs are still supported through a compatibility layer:
152+
153+
| Legacy Object | Legacy ProgID | v2.0 Standardized ProgID |
154+
| :--- | :--- | :--- |
155+
| `WebViewManager` | `NetWebView2.Manager` | `NetWebView2Lib.WebView2Manager` |
156+
| `WebViewBridge` | `NetWebView2Lib.WebViewBridge` | `NetWebView2Lib.WebView2Bridge` |
157+
| `JsonParser` | `NetJson.Parser` | `NetWebView2Lib.WebView2Parser` |
158+
159+
> [!NOTE]
160+
> Objects created with legacy ProgIDs will function exactly the same but will report their legacy class names via `ObjName()`.
97161
98-
#### **2. COM Version Exposure**
99-
You can now access the `.version` property on all primary COM objects.
100-
- **`Manager.version`**, **`Bridge.version`**, **`Parser.version`**.
101162

102-
#### **3. Stabilized Infrastructure**
103-
- **GUID Collision Resolution**: Fixed internal interface IDs that caused registration issues in v2.0.0-beta.1.
104-
- **`ParentWindowHandle`**: New property to retrieve the handle passed during initialization.
105163

106164
<p align="center">
107165
<img src="https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png" width="100%">
108166
</p>
109167

110-
## 📖 NetWebView2Lib Version 2.0.0-beta.3 (2026-02-11) (Quick Reference)
168+
## 📖 NetWebView2Lib Version 2.0.0-stable (Quick Reference)
111169

112-
### NetWebView2Lib (ProgId: NetWebView2.Manager)
170+
### WebView2Manager (ProgId: NetWebView2Lib.WebView2Manager)
113171

114172
#### ===Properties===
115173

@@ -181,6 +239,10 @@ Enables or disables the `OnWebResourceResponseReceived` event entirely.
181239
Determines whether `OnWebResourceResponseReceived` triggers for all resources (False) or only for the main document (True). Essential for preventing GUI deadlocks in AutoIt.
182240
`object.HttpStatusCodeDocumentOnly = Value`
183241

242+
##### Verbose
243+
Enable diagnostic logging to console. (before `$object.Initialize()`)
244+
`object.Verbose = Value`
245+
184246
##### IsDownloadHandled
185247
Determines whether the download is handled by the application. If set to **True** during `OnDownloadStarting`, the internal Edge download is cancelled.
186248
`object.IsDownloadHandled = Value`
@@ -211,14 +273,14 @@ A comma-separated list of Virtual Key codes to be blocked synchronously (e.g., "
211273

212274
##### FailureReportFolderPath
213275
Sets or gets the path where the WebView2 browser stores crash reports (dump files).
214-
- **Default**: If NOT set by the user, the system automatically uses the `Crashes` subfolder within the `UserDataFolder` (assigned during `.Initialize`).
276+
- **Default**: If NOT set by the user, the system automatically uses the `FailureReportFolderPath` subfolder within the `UserDataFolder` (assigned during `.Initialize`).
215277
- **Manual Override**: You can set a custom path **before** calling `.Initialize`.
216278
- **Example (Custom Path)**: `object.FailureReportFolderPath = "C:\MyCustomCrashDumps"`
217279
- **Example (Read current)**: `$sPath = object.FailureReportFolderPath`
218280

219281
##### Version
220-
Allows AutoIt to verify the DLL version at runtime for compatibility checks.
221-
`object.version
282+
Allows AutoIt to verify the DLL version at runtime for compatibility checks.
283+
`object.Version`
222284

223285
#### ===Method===
224286

@@ -316,6 +378,30 @@ Clears all active ad block rules.
316378
Asynchronously retrieves the full HTML source (sent via OnMessageReceived with 'HTML_SOURCE|').
317379
`object.GetHtmlSource()`
318380

381+
##### GetFrameCount
382+
Returns the number of currently tracked iframes.
383+
`object.GetFrameCount()`
384+
385+
##### GetFrameUrl
386+
Returns the URL of the specified frame index.
387+
`object.GetFrameUrl(Index As Integer)`
388+
389+
##### GetFrameName
390+
Returns the Name attribute of the specified frame index.
391+
`object.GetFrameName(Index As Integer)`
392+
393+
##### GetFrameUrls
394+
Returns a pipe-separated string of all tracked iframe URLs.
395+
`object.GetFrameUrls()`
396+
397+
##### GetFrameNames
398+
Returns a pipe-separated string of all tracked iframe names.
399+
`object.GetFrameNames()`
400+
401+
##### GetFrameHtmlSource
402+
Asynchronously retrieves the HTML of the frame at the specified index (sent via OnMessageReceived with 'FRAME_HTML_SOURCE|Index|').
403+
`object.GetFrameHtmlSource(Index As Integer)`
404+
319405
##### GetSelectedText
320406
Asynchronously retrieves the currently selected text (sent via OnMessageReceived with 'SELECTED_TEXT|').
321407
`object.GetSelectedText()`
@@ -622,12 +708,12 @@ Fired when the browser requires basic authentication credentials for a URI.
622708

623709
---
624710

625-
### JsonParser (ProgId: NetJson.Parser)
711+
### WebView2Parser (ProgId: NetWebView2Lib.WebView2Parser)
626712

627713
#### ===Properties===
628714
##### Version
629-
Allows AutoIt to verify the DLL version at runtime for compatibility checks.
630-
`object.version
715+
Allows AutoIt to verify the DLL version at runtime for compatibility checks.
716+
`object.Version`
631717

632718
#### ===Methods===
633719

@@ -751,3 +837,4 @@ Sorts a JSON array by a specific key.
751837
Removes duplicate objects from a JSON array based on a key's value.
752838
`bool SelectUnique(ArrayPath As String, Key As String)`
753839

840+
---

0 commit comments

Comments
 (0)