automation_model 1.0.385-dev → 1.0.385-main
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/lib/auto_page.d.ts +1 -1
- package/lib/auto_page.js +24 -1
- package/lib/auto_page.js.map +1 -1
- package/lib/stable_browser.d.ts +14 -2
- package/lib/stable_browser.js +401 -154
- package/lib/stable_browser.js.map +1 -1
- package/package.json +7 -3
package/lib/auto_page.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
declare const navigate: (path?: string) => Promise<void>;
|
|
2
|
-
declare const initContext: (path: string, doNavigate?: boolean, headless?: boolean, world?: any) => Promise<any>;
|
|
2
|
+
declare const initContext: (path: string, doNavigate?: boolean, headless?: boolean, world?: any, moveToRight?: number) => Promise<any>;
|
|
3
3
|
declare const closeContext: () => Promise<void>;
|
|
4
4
|
export { initContext, navigate, closeContext };
|
package/lib/auto_page.js
CHANGED
|
@@ -28,7 +28,7 @@ const _findEmptyFolder = (folder) => {
|
|
|
28
28
|
}
|
|
29
29
|
return path.join(folder, nextIndex.toString());
|
|
30
30
|
};
|
|
31
|
-
const initContext = async (path, doNavigate = true, headless = false, world = null) => {
|
|
31
|
+
const initContext = async (path, doNavigate = true, headless = false, world = null, moveToRight = -1) => {
|
|
32
32
|
if (context) {
|
|
33
33
|
return context;
|
|
34
34
|
}
|
|
@@ -55,6 +55,29 @@ const initContext = async (path, doNavigate = true, headless = false, world = nu
|
|
|
55
55
|
world.reportFolder = reportFolder;
|
|
56
56
|
context.reportFolder = reportFolder;
|
|
57
57
|
}
|
|
58
|
+
if (moveToRight > 0) {
|
|
59
|
+
// move the borwser to the top right corner of the screen
|
|
60
|
+
// create a cdp session
|
|
61
|
+
// Get CDP session
|
|
62
|
+
const playContext = context.playContext;
|
|
63
|
+
const client = await playContext.newCDPSession(context.page);
|
|
64
|
+
// Get window ID for the current target
|
|
65
|
+
const { windowId } = await client.send("Browser.getWindowForTarget");
|
|
66
|
+
console.log(windowId);
|
|
67
|
+
// get the window for the current target
|
|
68
|
+
const window = await client.send("Browser.getWindowBounds", {
|
|
69
|
+
windowId,
|
|
70
|
+
});
|
|
71
|
+
console.log(window);
|
|
72
|
+
await client.send("Browser.setWindowBounds", {
|
|
73
|
+
windowId,
|
|
74
|
+
bounds: {
|
|
75
|
+
left: window.bounds.left + moveToRight,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
// close cdp
|
|
79
|
+
await client.detach();
|
|
80
|
+
}
|
|
58
81
|
if (doNavigate) {
|
|
59
82
|
await navigate(path);
|
|
60
83
|
}
|
package/lib/auto_page.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto_page.js","sourceRoot":"","sources":["../../src/auto_page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,IAAI,OAAO,GAAuB,IAAI,CAAC;AACvC,IAAI,YAAY,GAAG,EAAE,CAAC;AACtB,MAAM,QAAQ,GAAG,KAAK,EAAE,IAAI,GAAG,EAAE,EAAE,EAAE;IACnC,IAAI,GAAG,GAAG,IAAI,CAAC;IACf,IAAI,IAAI,KAAK,IAAI,EAAE;QACjB,GAAG,GAAG,OAAQ,CAAC,WAAY,CAAC,OAAQ,CAAC;KACtC;SAAM;QACL,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,OAAQ,CAAC,WAAY,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC;KACzD;IACD,MAAM,OAAQ,CAAC,MAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjC,MAAM,OAAQ,CAAC,MAAO,CAAC,eAAe,EAAE,CAAC;AAC3C,CAAC,CAAC;AACF,MAAM,gBAAgB,GAAG,CAAC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AAE;QACd,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;KACtB;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,KAAK,IAAI,EAAE;IAC9B,IAAI;QACF,IAAI,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE;YAC9B,MAAM,cAAc,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;SACpD;KACF;IAAC,OAAO,CAAC,EAAE;QACV,sCAAsC;QACtC,SAAS;KACV;IACD,OAAO,GAAG,IAAI,CAAC;AACjB,CAAC,CAAC;AACF,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC"}
|
package/lib/stable_browser.d.ts
CHANGED
|
@@ -15,7 +15,10 @@ declare class StableBrowser {
|
|
|
15
15
|
goto(url: string): Promise<void>;
|
|
16
16
|
_validateSelectors(selectors: any): void;
|
|
17
17
|
_fixUsingParams(text: any, _params: Params): any;
|
|
18
|
-
|
|
18
|
+
_fixLocatorUsingParams(locator: any, _params: Params): any;
|
|
19
|
+
_isObject(value: any): any;
|
|
20
|
+
scanAndManipulate(currentObj: any, _params: Params): void;
|
|
21
|
+
_getLocator(locator: any, scope: any, _params: any): any;
|
|
19
22
|
_locateElmentByTextClimbCss(scope: any, text: any, climb: any, css: any, _params: Params): Promise<string | undefined>;
|
|
20
23
|
_locateElementByText(scope: any, text1: any, tag1: any, regex1: boolean | undefined, partial1: any, _params: Params): Promise<any>;
|
|
21
24
|
_collectLocatorInformation(selectorHierarchy: any, index: number | undefined, scope: any, foundLocators: any, _params: Params, info: any, visibleOnly?: boolean): Promise<void>;
|
|
@@ -32,6 +35,7 @@ declare class StableBrowser {
|
|
|
32
35
|
hover(selectors: any, _params?: Params, options?: {}, world?: null): Promise<{}>;
|
|
33
36
|
selectOption(selectors: any, values: any, _params?: null, options?: {}, world?: null): Promise<{}>;
|
|
34
37
|
type(_value: any, _params?: null, options?: {}, world?: null): Promise<{}>;
|
|
38
|
+
setInputValue(selectors: any, value: any, _params?: null, options?: {}, world?: null): Promise<void>;
|
|
35
39
|
setDateTime(selectors: any, value: any, format?: null, enter?: boolean, _params?: null, options?: {}, world?: null): Promise<void>;
|
|
36
40
|
clickType(selectors: any, _value: any, enter?: boolean, _params?: null, options?: {}, world?: null): Promise<{}>;
|
|
37
41
|
fill(selectors: any, value: any, enter?: boolean, _params?: null, options?: {}, world?: null): Promise<{}>;
|
|
@@ -62,22 +66,30 @@ declare class StableBrowser {
|
|
|
62
66
|
element?: undefined;
|
|
63
67
|
}>;
|
|
64
68
|
containsPattern(selectors: any, pattern: any, text: any, _params?: null, options?: {}, world?: null): Promise<{}>;
|
|
65
|
-
containsText(selectors: any, text: any, climb: any, _params?: null, options?: {}, world?: null): Promise<
|
|
69
|
+
containsText(selectors: any, text: any, climb: any, _params?: null, options?: {}, world?: null): Promise<void>;
|
|
66
70
|
_getDataFile(world?: null): string;
|
|
67
71
|
setTestData(testData: any, world?: null): void;
|
|
72
|
+
_getDataFilePath(fileName: any): string;
|
|
73
|
+
_parseCSVSync(filePath: any): Promise<unknown>;
|
|
68
74
|
loadTestData(type: string, dataSelector: string, world?: null): {
|
|
69
75
|
username: any;
|
|
70
76
|
password: string;
|
|
71
77
|
totp: string | null;
|
|
72
78
|
};
|
|
79
|
+
loadTestDataAsync(type: string, dataSelector: string, world?: null): Promise<any>;
|
|
73
80
|
getTestData(world?: null): {};
|
|
74
81
|
_screenShot(options?: {}, world?: null, info?: null): Promise<{}>;
|
|
75
82
|
takeScreenshot(screenshotPath: any): Promise<any>;
|
|
76
83
|
verifyElementExistInPage(selectors: any, _params?: null, options?: {}, world?: null): Promise<{}>;
|
|
77
84
|
extractAttribute(selectors: any, attribute: any, variable: any, _params?: null, options?: {}, world?: null): Promise<{}>;
|
|
85
|
+
extractEmailData(emailAddress: any, options: any, world: any): Promise<{
|
|
86
|
+
emailUrl: any;
|
|
87
|
+
emailCode: any;
|
|
88
|
+
}>;
|
|
78
89
|
_highlightElements(scope: any, css: any): Promise<void>;
|
|
79
90
|
verifyPagePath(pathPart: any, options?: {}, world?: null): Promise<{} | undefined>;
|
|
80
91
|
verifyTextExistInPage(text: any, options?: {}, world?: null): Promise<{}>;
|
|
92
|
+
_getServerUrl(): string;
|
|
81
93
|
visualVerification(text: any, options?: {}, world?: null): Promise<{}>;
|
|
82
94
|
verifyTableData(selectors: any, data: any, _params?: null, options?: {}, world?: null): Promise<void>;
|
|
83
95
|
getTableData(selectors: any, _params?: null, options?: {}, world?: null): Promise<any>;
|