@letsscrapedata/controller 0.0.6 → 0.0.7
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/dist/index.cjs +17 -4
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +17 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -233,9 +233,15 @@ var PlaywrightElement = class _PlaywrightElement {
|
|
|
233
233
|
return text3 ? text3 : "";
|
|
234
234
|
}
|
|
235
235
|
async click(options = {}) {
|
|
236
|
-
const { button, clickCount: count, delay, position: offset } = options;
|
|
236
|
+
const { button, clickCount: count, delay, position: offset, clickType = "click" } = options;
|
|
237
237
|
const actOptions = { button, count, delay, offset };
|
|
238
|
-
|
|
238
|
+
if (clickType === "click") {
|
|
239
|
+
await this.#locator.click(actOptions);
|
|
240
|
+
} else if (clickType === "evaluate") {
|
|
241
|
+
await this.#locator.evaluate(async (ev) => await ev.click());
|
|
242
|
+
} else {
|
|
243
|
+
(0, import_utils.unreachable)(clickType);
|
|
244
|
+
}
|
|
239
245
|
return true;
|
|
240
246
|
}
|
|
241
247
|
async focus() {
|
|
@@ -1650,9 +1656,16 @@ var PuppeteerElement = class _PuppeteerElement {
|
|
|
1650
1656
|
return text3 ? text3 : "";
|
|
1651
1657
|
}
|
|
1652
1658
|
async click(options = {}) {
|
|
1653
|
-
const { button, clickCount: count, delay, position: offset } = options;
|
|
1659
|
+
const { button, clickCount: count, delay, position: offset, clickType = "click" } = options;
|
|
1654
1660
|
const actOptions = { button, count, delay, offset };
|
|
1655
|
-
|
|
1661
|
+
if (clickType === "click") {
|
|
1662
|
+
await this.#$ele.click(actOptions);
|
|
1663
|
+
} else if (clickType === "evaluate") {
|
|
1664
|
+
await this.#frame.evaluate(async (ev) => await ev.click(), this.#$ele);
|
|
1665
|
+
await this.#$ele.click(actOptions);
|
|
1666
|
+
} else {
|
|
1667
|
+
(0, import_utils5.unreachable)(clickType);
|
|
1668
|
+
}
|
|
1656
1669
|
return true;
|
|
1657
1670
|
}
|
|
1658
1671
|
async focus() {
|
package/dist/index.d.cts
CHANGED
|
@@ -222,6 +222,7 @@ interface PageExtInPuppeteer extends Page$1 {
|
|
|
222
222
|
interface PageExtInPlaywright extends Page {
|
|
223
223
|
pageInfo?: PageInfo;
|
|
224
224
|
}
|
|
225
|
+
type MouseClickType = "click" | "evaluate";
|
|
225
226
|
interface MouseClickOptions {
|
|
226
227
|
/**
|
|
227
228
|
* Which button will be pressed.
|
|
@@ -252,6 +253,10 @@ interface MouseClickOptions {
|
|
|
252
253
|
* * puppeteer: not supported, ignored
|
|
253
254
|
*/
|
|
254
255
|
modifiers?: Array<"Alt" | "Control" | "Meta" | "Shift">;
|
|
256
|
+
/**
|
|
257
|
+
* @default click
|
|
258
|
+
*/
|
|
259
|
+
clickType?: MouseClickType;
|
|
255
260
|
}
|
|
256
261
|
interface SelectOptions {
|
|
257
262
|
/**
|
|
@@ -1211,4 +1216,4 @@ declare class CheerioElement implements LsdElement {
|
|
|
1211
1216
|
scrollIntoView(): Promise<boolean>;
|
|
1212
1217
|
}
|
|
1213
1218
|
|
|
1214
|
-
export { type AllBrowser, type AllBrowserContext, type AllFrame, type AllPage, type AllResponse, type BrowserControllerOptions, type BrowserControllerType, type BrowserCreationMethod, type BrowserManager, CheerioElement, type CheerioNode, CheerioPage, type CookieItem, type GotoOptions, type IframeOption, type InputOptions, type KeyInput, type KeyPressOptions, type LocalStorageItem, type LocalStorageOrigin, type LowerCasePaperFormat, type LsdBrowser, type LsdBrowserContext, type LsdBrowserContextOptions, type LsdBrowserController, type LsdBrowserType, type LsdConnectOptions, type LsdElement, type LsdLaunchOptions, type LsdPage, type MouseClickOptions, type NavigationWaitUntil, type PDFMargin, type PDFOptions, type PageEvent, type PageExtInPlaywright, type PageExtInPuppeteer, type PageInfo, type PageOpenType, type PageStatus, type PaperFormat, PlaywrightBrowser, PlaywrightBrowserContext, PlaywrightElement, PlaywrightPage, type Proxy, PuppeteerBrowser, PuppeteerBrowserContext, PuppeteerElement, PuppeteerPage, type RequestInterceptionAction, type RequestInterceptionOption, type RequestMatch, type RequestMethod, type RequestResourceType, type ResponseHandler, type ResponseHandlerOptions, type ResponseInterceptionItem, type ResponseInterceptionOption, type ResponseMatch, type ScreenshotOptions, type SelectOptions, type StateData, type UpdatablePageInfo, type ViewportSize, type WaitElementOptions, type WaitElementState, type WaitNavigationOptions, defaultProxy };
|
|
1219
|
+
export { type AllBrowser, type AllBrowserContext, type AllFrame, type AllPage, type AllResponse, type BrowserControllerOptions, type BrowserControllerType, type BrowserCreationMethod, type BrowserManager, CheerioElement, type CheerioNode, CheerioPage, type CookieItem, type GotoOptions, type IframeOption, type InputOptions, type KeyInput, type KeyPressOptions, type LocalStorageItem, type LocalStorageOrigin, type LowerCasePaperFormat, type LsdBrowser, type LsdBrowserContext, type LsdBrowserContextOptions, type LsdBrowserController, type LsdBrowserType, type LsdConnectOptions, type LsdElement, type LsdLaunchOptions, type LsdPage, type MouseClickOptions, type MouseClickType, type NavigationWaitUntil, type PDFMargin, type PDFOptions, type PageEvent, type PageExtInPlaywright, type PageExtInPuppeteer, type PageInfo, type PageOpenType, type PageStatus, type PaperFormat, PlaywrightBrowser, PlaywrightBrowserContext, PlaywrightElement, PlaywrightPage, type Proxy, PuppeteerBrowser, PuppeteerBrowserContext, PuppeteerElement, PuppeteerPage, type RequestInterceptionAction, type RequestInterceptionOption, type RequestMatch, type RequestMethod, type RequestResourceType, type ResponseHandler, type ResponseHandlerOptions, type ResponseInterceptionItem, type ResponseInterceptionOption, type ResponseMatch, type ScreenshotOptions, type SelectOptions, type StateData, type UpdatablePageInfo, type ViewportSize, type WaitElementOptions, type WaitElementState, type WaitNavigationOptions, defaultProxy };
|
package/dist/index.d.ts
CHANGED
|
@@ -222,6 +222,7 @@ interface PageExtInPuppeteer extends Page$1 {
|
|
|
222
222
|
interface PageExtInPlaywright extends Page {
|
|
223
223
|
pageInfo?: PageInfo;
|
|
224
224
|
}
|
|
225
|
+
type MouseClickType = "click" | "evaluate";
|
|
225
226
|
interface MouseClickOptions {
|
|
226
227
|
/**
|
|
227
228
|
* Which button will be pressed.
|
|
@@ -252,6 +253,10 @@ interface MouseClickOptions {
|
|
|
252
253
|
* * puppeteer: not supported, ignored
|
|
253
254
|
*/
|
|
254
255
|
modifiers?: Array<"Alt" | "Control" | "Meta" | "Shift">;
|
|
256
|
+
/**
|
|
257
|
+
* @default click
|
|
258
|
+
*/
|
|
259
|
+
clickType?: MouseClickType;
|
|
255
260
|
}
|
|
256
261
|
interface SelectOptions {
|
|
257
262
|
/**
|
|
@@ -1211,4 +1216,4 @@ declare class CheerioElement implements LsdElement {
|
|
|
1211
1216
|
scrollIntoView(): Promise<boolean>;
|
|
1212
1217
|
}
|
|
1213
1218
|
|
|
1214
|
-
export { type AllBrowser, type AllBrowserContext, type AllFrame, type AllPage, type AllResponse, type BrowserControllerOptions, type BrowserControllerType, type BrowserCreationMethod, type BrowserManager, CheerioElement, type CheerioNode, CheerioPage, type CookieItem, type GotoOptions, type IframeOption, type InputOptions, type KeyInput, type KeyPressOptions, type LocalStorageItem, type LocalStorageOrigin, type LowerCasePaperFormat, type LsdBrowser, type LsdBrowserContext, type LsdBrowserContextOptions, type LsdBrowserController, type LsdBrowserType, type LsdConnectOptions, type LsdElement, type LsdLaunchOptions, type LsdPage, type MouseClickOptions, type NavigationWaitUntil, type PDFMargin, type PDFOptions, type PageEvent, type PageExtInPlaywright, type PageExtInPuppeteer, type PageInfo, type PageOpenType, type PageStatus, type PaperFormat, PlaywrightBrowser, PlaywrightBrowserContext, PlaywrightElement, PlaywrightPage, type Proxy, PuppeteerBrowser, PuppeteerBrowserContext, PuppeteerElement, PuppeteerPage, type RequestInterceptionAction, type RequestInterceptionOption, type RequestMatch, type RequestMethod, type RequestResourceType, type ResponseHandler, type ResponseHandlerOptions, type ResponseInterceptionItem, type ResponseInterceptionOption, type ResponseMatch, type ScreenshotOptions, type SelectOptions, type StateData, type UpdatablePageInfo, type ViewportSize, type WaitElementOptions, type WaitElementState, type WaitNavigationOptions, defaultProxy };
|
|
1219
|
+
export { type AllBrowser, type AllBrowserContext, type AllFrame, type AllPage, type AllResponse, type BrowserControllerOptions, type BrowserControllerType, type BrowserCreationMethod, type BrowserManager, CheerioElement, type CheerioNode, CheerioPage, type CookieItem, type GotoOptions, type IframeOption, type InputOptions, type KeyInput, type KeyPressOptions, type LocalStorageItem, type LocalStorageOrigin, type LowerCasePaperFormat, type LsdBrowser, type LsdBrowserContext, type LsdBrowserContextOptions, type LsdBrowserController, type LsdBrowserType, type LsdConnectOptions, type LsdElement, type LsdLaunchOptions, type LsdPage, type MouseClickOptions, type MouseClickType, type NavigationWaitUntil, type PDFMargin, type PDFOptions, type PageEvent, type PageExtInPlaywright, type PageExtInPuppeteer, type PageInfo, type PageOpenType, type PageStatus, type PaperFormat, PlaywrightBrowser, PlaywrightBrowserContext, PlaywrightElement, PlaywrightPage, type Proxy, PuppeteerBrowser, PuppeteerBrowserContext, PuppeteerElement, PuppeteerPage, type RequestInterceptionAction, type RequestInterceptionOption, type RequestMatch, type RequestMethod, type RequestResourceType, type ResponseHandler, type ResponseHandlerOptions, type ResponseInterceptionItem, type ResponseInterceptionOption, type ResponseMatch, type ScreenshotOptions, type SelectOptions, type StateData, type UpdatablePageInfo, type ViewportSize, type WaitElementOptions, type WaitElementState, type WaitNavigationOptions, defaultProxy };
|
package/dist/index.js
CHANGED
|
@@ -214,9 +214,15 @@ var PlaywrightElement = class _PlaywrightElement {
|
|
|
214
214
|
return text3 ? text3 : "";
|
|
215
215
|
}
|
|
216
216
|
async click(options = {}) {
|
|
217
|
-
const { button, clickCount: count, delay, position: offset } = options;
|
|
217
|
+
const { button, clickCount: count, delay, position: offset, clickType = "click" } = options;
|
|
218
218
|
const actOptions = { button, count, delay, offset };
|
|
219
|
-
|
|
219
|
+
if (clickType === "click") {
|
|
220
|
+
await this.#locator.click(actOptions);
|
|
221
|
+
} else if (clickType === "evaluate") {
|
|
222
|
+
await this.#locator.evaluate(async (ev) => await ev.click());
|
|
223
|
+
} else {
|
|
224
|
+
unreachable(clickType);
|
|
225
|
+
}
|
|
220
226
|
return true;
|
|
221
227
|
}
|
|
222
228
|
async focus() {
|
|
@@ -1631,9 +1637,16 @@ var PuppeteerElement = class _PuppeteerElement {
|
|
|
1631
1637
|
return text3 ? text3 : "";
|
|
1632
1638
|
}
|
|
1633
1639
|
async click(options = {}) {
|
|
1634
|
-
const { button, clickCount: count, delay, position: offset } = options;
|
|
1640
|
+
const { button, clickCount: count, delay, position: offset, clickType = "click" } = options;
|
|
1635
1641
|
const actOptions = { button, count, delay, offset };
|
|
1636
|
-
|
|
1642
|
+
if (clickType === "click") {
|
|
1643
|
+
await this.#$ele.click(actOptions);
|
|
1644
|
+
} else if (clickType === "evaluate") {
|
|
1645
|
+
await this.#frame.evaluate(async (ev) => await ev.click(), this.#$ele);
|
|
1646
|
+
await this.#$ele.click(actOptions);
|
|
1647
|
+
} else {
|
|
1648
|
+
unreachable3(clickType);
|
|
1649
|
+
}
|
|
1637
1650
|
return true;
|
|
1638
1651
|
}
|
|
1639
1652
|
async focus() {
|
package/package.json
CHANGED