@monostate/node-scraper 2.2.1 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser-session.js +11 -3
- package/package.json +1 -1
package/browser-session.js
CHANGED
|
@@ -521,10 +521,18 @@ export class BrowserSession {
|
|
|
521
521
|
|
|
522
522
|
async typeText(text) {
|
|
523
523
|
this._ensureConnected();
|
|
524
|
-
|
|
525
|
-
|
|
524
|
+
// Use Puppeteer keyboard when we have a page — works with both selector
|
|
525
|
+
// clicks (CDP focus) and coordinate clicks (X11 focus propagates to DOM).
|
|
526
|
+
// xdotool typeText only reaches the X11-focused window, not the DOM-focused
|
|
527
|
+
// element, so it fails when mixed with selector-based click.
|
|
528
|
+
if (this.page) {
|
|
529
|
+
await this.page.keyboard.type(text);
|
|
530
|
+
} else {
|
|
531
|
+
this._ensureProvider();
|
|
532
|
+
await this.provider.typeText(text);
|
|
533
|
+
}
|
|
526
534
|
this._logAction('typeText', { text: text.substring(0, 20) + (text.length > 20 ? '...' : '') });
|
|
527
|
-
return
|
|
535
|
+
return { success: true };
|
|
528
536
|
}
|
|
529
537
|
|
|
530
538
|
async getCursorPosition() {
|
package/package.json
CHANGED