jumpy-lion 0.0.34 → 0.0.36
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/README.md +510 -0
- package/dist/fingerprinting/anti-webgpu/background.js +4 -6
- package/dist/fingerprinting/anti-webgpu/data/content_script/inject.js +42 -42
- package/dist/fingerprinting/anti-webgpu/data/content_script/page_context/inject.js +172 -179
- package/dist/fingerprinting/anti-webgpu/data/icons/128.png +0 -0
- package/dist/fingerprinting/anti-webgpu/data/icons/16.png +0 -0
- package/dist/fingerprinting/anti-webgpu/data/icons/32.png +0 -0
- package/dist/fingerprinting/anti-webgpu/data/icons/48.png +0 -0
- package/dist/fingerprinting/anti-webgpu/data/icons/64.png +0 -0
- package/dist/fingerprinting/anti-webgpu/data/popup/popup.css +88 -0
- package/dist/fingerprinting/anti-webgpu/data/popup/popup.html +58 -0
- package/dist/fingerprinting/anti-webgpu/data/popup/popup.js +96 -95
- package/dist/fingerprinting/anti-webgpu/lib/chrome.js +249 -255
- package/dist/fingerprinting/anti-webgpu/lib/common.js +71 -72
- package/dist/fingerprinting/anti-webgpu/lib/config.js +14 -13
- package/dist/fingerprinting/anti-webgpu/lib/runtime.js +107 -109
- package/dist/fingerprinting/anti-webgpu/manifest.json +58 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/page.d.ts +72 -1
- package/dist/page.d.ts.map +1 -1
- package/dist/page.js +574 -11
- package/dist/page.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -1,87 +1,86 @@
|
|
|
1
1
|
var core = {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
"start": function () {
|
|
3
|
+
core.load();
|
|
4
|
+
},
|
|
5
|
+
"install": function () {
|
|
6
|
+
core.load();
|
|
7
|
+
},
|
|
8
|
+
"load": function () {
|
|
9
|
+
app.contextmenu.create({
|
|
10
|
+
"type": "normal",
|
|
11
|
+
"id": "test.page",
|
|
12
|
+
"contexts": ["browser_action"],
|
|
13
|
+
"title": "What is my Fingerprint?"
|
|
14
|
+
}, app.error);
|
|
15
|
+
/* */
|
|
16
|
+
app.contextmenu.create({
|
|
17
|
+
"type": "checkbox",
|
|
18
|
+
"id": "notification.checkbox",
|
|
19
|
+
"contexts": ["browser_action"],
|
|
20
|
+
"checked": config.notification.show,
|
|
21
|
+
"title": "Show Desktop Notifications"
|
|
22
|
+
}, app.error);
|
|
23
|
+
},
|
|
24
|
+
"action": {
|
|
25
|
+
"contextmenu": function (e) {
|
|
26
|
+
if (e.menuItemId === "test.page") {
|
|
27
|
+
app.tab.open(config.test.page);
|
|
28
|
+
} else {
|
|
29
|
+
config.notification.show = !config.notification.show;
|
|
30
|
+
}
|
|
4
31
|
},
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
app.contextmenu.create({
|
|
10
|
-
"type": "normal",
|
|
11
|
-
"id": "test.page",
|
|
12
|
-
"contexts": ["browser_action"],
|
|
13
|
-
"title": "What is my Fingerprint?"
|
|
14
|
-
}, app.error);
|
|
15
|
-
/* */
|
|
16
|
-
app.contextmenu.create({
|
|
17
|
-
"type": "checkbox",
|
|
18
|
-
"id": "notification.checkbox",
|
|
19
|
-
"contexts": ["browser_action"],
|
|
20
|
-
"checked": config.notification.show,
|
|
21
|
-
"title": "Show Desktop Notifications"
|
|
32
|
+
"storage": function (changes, namespace) {
|
|
33
|
+
if ("notification" in changes) {
|
|
34
|
+
app.contextmenu.update("notification.checkbox", {
|
|
35
|
+
"checked": config.notification.show,
|
|
22
36
|
}, app.error);
|
|
37
|
+
}
|
|
23
38
|
},
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}, app.error);
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"page": {
|
|
41
|
-
"fingerprint": function (e) {
|
|
42
|
-
const message = "\nA fingerprinting attempt is detected!\nYour browser is reporting a fake value.";
|
|
43
|
-
/* */
|
|
44
|
-
if (config.notification.show) {
|
|
45
|
-
if (config.notification.timeout)
|
|
46
|
-
clearTimeout(config.notification.timeout);
|
|
47
|
-
config.notification.timeout = setTimeout(function () {
|
|
48
|
-
app.notifications.create({
|
|
49
|
-
"type": "basic",
|
|
50
|
-
"title": app.name(),
|
|
51
|
-
"message": e.host + message
|
|
52
|
-
});
|
|
53
|
-
}, 1000);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
"popup": {
|
|
58
|
-
"fingerprint": function () {
|
|
59
|
-
app.tab.open(config.test.page);
|
|
60
|
-
},
|
|
61
|
-
"load": function () {
|
|
62
|
-
app.popup.send("storage", {
|
|
63
|
-
"notifications": config.notification.show
|
|
64
|
-
});
|
|
65
|
-
},
|
|
66
|
-
"notifications": function () {
|
|
67
|
-
config.notification.show = !config.notification.show;
|
|
68
|
-
/* */
|
|
69
|
-
app.popup.send("storage", {
|
|
70
|
-
"notifications": config.notification.show
|
|
71
|
-
});
|
|
72
|
-
}
|
|
39
|
+
"page": {
|
|
40
|
+
"fingerprint": function (e) {
|
|
41
|
+
const message = "\nA fingerprinting attempt is detected!\nYour browser is reporting a fake value.";
|
|
42
|
+
/* */
|
|
43
|
+
if (config.notification.show) {
|
|
44
|
+
if (config.notification.timeout) clearTimeout(config.notification.timeout);
|
|
45
|
+
config.notification.timeout = setTimeout(function () {
|
|
46
|
+
app.notifications.create({
|
|
47
|
+
"type": "basic",
|
|
48
|
+
"title": app.name(),
|
|
49
|
+
"message": e.host + message
|
|
50
|
+
});
|
|
51
|
+
}, 1000);
|
|
73
52
|
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"popup": {
|
|
56
|
+
"fingerprint": function () {
|
|
57
|
+
app.tab.open(config.test.page);
|
|
58
|
+
},
|
|
59
|
+
"load": function () {
|
|
60
|
+
app.popup.send("storage", {
|
|
61
|
+
"notifications": config.notification.show
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
"notifications": function () {
|
|
65
|
+
config.notification.show = !config.notification.show;
|
|
66
|
+
/* */
|
|
67
|
+
app.popup.send("storage", {
|
|
68
|
+
"notifications": config.notification.show
|
|
69
|
+
});
|
|
70
|
+
}
|
|
74
71
|
}
|
|
72
|
+
}
|
|
75
73
|
};
|
|
74
|
+
|
|
76
75
|
app.contextmenu.on.clicked(core.action.contextmenu);
|
|
77
76
|
app.page.receive("fingerprint", core.action.page.fingerprint);
|
|
77
|
+
|
|
78
78
|
app.popup.receive("load", core.action.popup.load);
|
|
79
79
|
app.popup.receive("fingerprint", core.action.popup.fingerprint);
|
|
80
80
|
app.popup.receive("notifications", core.action.popup.notifications);
|
|
81
|
-
app.popup.receive("support", function () {
|
|
82
|
-
app.popup.receive("donation", function () {
|
|
81
|
+
app.popup.receive("support", function () {app.tab.open(app.homepage())});
|
|
82
|
+
app.popup.receive("donation", function () {app.tab.open(app.homepage() + "?reason=support")});
|
|
83
|
+
|
|
83
84
|
app.on.startup(core.start);
|
|
84
85
|
app.on.installed(core.install);
|
|
85
86
|
app.on.storage(core.action.storage);
|
|
86
|
-
export {};
|
|
87
|
-
//# sourceMappingURL=common.js.map
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
var config = {};
|
|
2
|
-
|
|
3
|
-
config.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
var config = {};
|
|
2
|
+
|
|
3
|
+
config.test = {"page": "https://webbrowsertools.com/webgpu-fingerprint/"};
|
|
4
|
+
|
|
5
|
+
config.welcome = {
|
|
6
|
+
set lastupdate (val) {app.storage.write("lastupdate", val)},
|
|
7
|
+
get lastupdate () {return app.storage.read("lastupdate") !== undefined ? app.storage.read("lastupdate") : 0}
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
config.notification = {
|
|
11
|
+
"timeout": null,
|
|
12
|
+
set show (val) {app.storage.write("notification", val)},
|
|
13
|
+
get show () {return app.storage.read("notification") !== undefined ? app.storage.read("notification") : false}
|
|
14
|
+
};
|
|
@@ -1,109 +1,107 @@
|
|
|
1
|
-
app.version = function () {
|
|
2
|
-
app.homepage = function () {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
app.on.connect(function (port) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
});
|
|
108
|
-
export {};
|
|
109
|
-
//# sourceMappingURL=runtime.js.map
|
|
1
|
+
app.version = function () {return chrome.runtime.getManifest().version};
|
|
2
|
+
app.homepage = function () {return chrome.runtime.getManifest().homepage_url};
|
|
3
|
+
|
|
4
|
+
if (!navigator.webdriver) {
|
|
5
|
+
app.on.uninstalled(app.homepage() + "?v=" + app.version() + "&type=uninstall");
|
|
6
|
+
app.on.installed(function (e) {
|
|
7
|
+
app.on.management(function (result) {
|
|
8
|
+
if (result.installType === "normal") {
|
|
9
|
+
app.tab.query.index(function (index) {
|
|
10
|
+
let previous = e.previousVersion !== undefined && e.previousVersion !== app.version();
|
|
11
|
+
let doupdate = previous && parseInt((Date.now() - config.welcome.lastupdate) / (24 * 3600 * 1000)) > 45;
|
|
12
|
+
if (e.reason === "install" || (e.reason === "update" && doupdate)) {
|
|
13
|
+
let parameter = (e.previousVersion ? "&p=" + e.previousVersion : '') + "&type=" + e.reason;
|
|
14
|
+
let url = app.homepage() + "?v=" + app.version() + parameter;
|
|
15
|
+
app.tab.open(url, index, e.reason === "install");
|
|
16
|
+
config.welcome.lastupdate = Date.now();
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
app.on.message(function (request, sender) {
|
|
25
|
+
if (request) {
|
|
26
|
+
if (request.path === "popup-to-background") {
|
|
27
|
+
for (let id in app.popup.message) {
|
|
28
|
+
if (app.popup.message[id]) {
|
|
29
|
+
if ((typeof app.popup.message[id]) === "function") {
|
|
30
|
+
if (id === request.method) {
|
|
31
|
+
app.popup.message[id](request.data);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/* */
|
|
38
|
+
if (request.path === "page-to-background") {
|
|
39
|
+
for (let id in app.page.message) {
|
|
40
|
+
if (app.page.message[id]) {
|
|
41
|
+
if ((typeof app.page.message[id]) === "function") {
|
|
42
|
+
if (id === request.method) {
|
|
43
|
+
let a = request.data || {};
|
|
44
|
+
if (sender) {
|
|
45
|
+
a.frameId = sender.frameId;
|
|
46
|
+
/* */
|
|
47
|
+
if (sender.tab) {
|
|
48
|
+
if (a.tabId === undefined) a.tabId = sender.tab.id;
|
|
49
|
+
if (a.title === undefined) a.title = sender.tab.title ? sender.tab.title : '';
|
|
50
|
+
if (a.top === undefined) a.top = sender.tab.url ? sender.tab.url : (sender.url ? sender.url : '');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/* */
|
|
54
|
+
app.page.message[id](a);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
app.on.connect(function (port) {
|
|
64
|
+
if (port) {
|
|
65
|
+
if (port.name) {
|
|
66
|
+
if (port.name in app) {
|
|
67
|
+
app[port.name].port = port;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/* */
|
|
71
|
+
port.onDisconnect.addListener(function (e) {
|
|
72
|
+
app.storage.load(function () {
|
|
73
|
+
if (e) {
|
|
74
|
+
if (e.name) {
|
|
75
|
+
if (e.name in app) {
|
|
76
|
+
app[e.name].port = null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
/* */
|
|
83
|
+
port.onMessage.addListener(function (e) {
|
|
84
|
+
app.storage.load(function () {
|
|
85
|
+
if (e) {
|
|
86
|
+
if (e.path) {
|
|
87
|
+
if (e.port) {
|
|
88
|
+
if (e.port in app) {
|
|
89
|
+
if (e.path === (e.port + "-to-background")) {
|
|
90
|
+
for (let id in app[e.port].message) {
|
|
91
|
+
if (app[e.port].message[id]) {
|
|
92
|
+
if ((typeof app[e.port].message[id]) === "function") {
|
|
93
|
+
if (id === e.method) {
|
|
94
|
+
app[e.port].message[id](e.data);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"update_url": "https://clients2.google.com/service/update2/crx",
|
|
3
|
+
|
|
4
|
+
"version": "0.1.1",
|
|
5
|
+
"manifest_version": 3,
|
|
6
|
+
"offline_enabled": true,
|
|
7
|
+
"name": "WebGPU Fingerprint Defender",
|
|
8
|
+
"homepage_url": "https://mybrowseraddon.com/webgpu-defender.html",
|
|
9
|
+
"description": "Defending against WebGPU fingerprinting by reporting a fake value.",
|
|
10
|
+
"commands": {
|
|
11
|
+
"_execute_action": {}
|
|
12
|
+
},
|
|
13
|
+
"background": {
|
|
14
|
+
"service_worker": "background.js"
|
|
15
|
+
},
|
|
16
|
+
"permissions": [
|
|
17
|
+
"storage",
|
|
18
|
+
"contextMenus",
|
|
19
|
+
"notifications"
|
|
20
|
+
],
|
|
21
|
+
"action": {
|
|
22
|
+
"default_popup": "data/popup/popup.html",
|
|
23
|
+
"default_title": "WebGPU Fingerprint Defender",
|
|
24
|
+
"default_icon": {
|
|
25
|
+
"16": "data/icons/16.png",
|
|
26
|
+
"32": "data/icons/32.png",
|
|
27
|
+
"48": "data/icons/48.png",
|
|
28
|
+
"64": "data/icons/64.png"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"content_scripts": [
|
|
32
|
+
{
|
|
33
|
+
"world": "MAIN",
|
|
34
|
+
"all_frames": true,
|
|
35
|
+
"matches": ["*://*/*"],
|
|
36
|
+
"match_about_blank": true,
|
|
37
|
+
"run_at": "document_start",
|
|
38
|
+
"match_origin_as_fallback": true,
|
|
39
|
+
"js": ["data/content_script/page_context/inject.js"]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"world": "ISOLATED",
|
|
43
|
+
"all_frames": true,
|
|
44
|
+
"matches": ["*://*/*"],
|
|
45
|
+
"match_about_blank": true,
|
|
46
|
+
"run_at": "document_start",
|
|
47
|
+
"match_origin_as_fallback": true,
|
|
48
|
+
"js": ["data/content_script/inject.js"]
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"icons": {
|
|
52
|
+
"16": "data/icons/16.png",
|
|
53
|
+
"32": "data/icons/32.png",
|
|
54
|
+
"48": "data/icons/48.png",
|
|
55
|
+
"64": "data/icons/64.png",
|
|
56
|
+
"128": "data/icons/128.png"
|
|
57
|
+
}
|
|
58
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ import CdpPage from "./page.js";
|
|
|
3
3
|
export default CDPCrawler;
|
|
4
4
|
export { createCDPRouter } from "./crawler.js";
|
|
5
5
|
export type { CDPRouter } from "./crawler.js";
|
|
6
|
-
export type { GotoOptions } from "./page.js";
|
|
6
|
+
export type { GotoOptions, SelectOptionOptions } from "./page.js";
|
|
7
7
|
export { CdpPage };
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC,eAAe,UAAU,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC,eAAe,UAAU,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,YAAY,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
package/dist/page.d.ts
CHANGED
|
@@ -25,6 +25,14 @@ export interface GotoOptions {
|
|
|
25
25
|
waitUntil?: "domcontentloaded" | "load";
|
|
26
26
|
timeout?: number;
|
|
27
27
|
}
|
|
28
|
+
export interface SelectOptionOptions {
|
|
29
|
+
timeout?: number;
|
|
30
|
+
force?: boolean;
|
|
31
|
+
waitForOptions?: boolean;
|
|
32
|
+
maxScrollAttempts?: number;
|
|
33
|
+
optionSelector?: string;
|
|
34
|
+
dropdownSelector?: string;
|
|
35
|
+
}
|
|
28
36
|
export interface EvaluateResult {
|
|
29
37
|
result: any;
|
|
30
38
|
exceptionDetails?: {
|
|
@@ -51,7 +59,49 @@ export default class CdpPage extends EventEmitter {
|
|
|
51
59
|
*/
|
|
52
60
|
reload(options?: GotoOptions): Promise<void>;
|
|
53
61
|
evaluate<T>(pageFunction: Function | string, ...args: any[]): Promise<T>;
|
|
54
|
-
click(selector: string
|
|
62
|
+
click(selector: string, options?: {
|
|
63
|
+
timeout?: number;
|
|
64
|
+
force?: boolean;
|
|
65
|
+
delay?: number;
|
|
66
|
+
button?: 'left' | 'right' | 'middle';
|
|
67
|
+
clickCount?: number;
|
|
68
|
+
}): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Performs a human-like click with proper mouse events
|
|
71
|
+
*/
|
|
72
|
+
private _performClick;
|
|
73
|
+
/**
|
|
74
|
+
* Gets detailed information about an element
|
|
75
|
+
*/
|
|
76
|
+
private _getElementInfo;
|
|
77
|
+
/**
|
|
78
|
+
* Enhanced visibility check that considers more factors
|
|
79
|
+
*/
|
|
80
|
+
private _isElementVisible;
|
|
81
|
+
/**
|
|
82
|
+
* Enhanced clickable check that considers more factors
|
|
83
|
+
*/
|
|
84
|
+
private _isElementClickable;
|
|
85
|
+
/**
|
|
86
|
+
* Enhanced scroll into view with better positioning
|
|
87
|
+
*/
|
|
88
|
+
private _scrollElementIntoView;
|
|
89
|
+
/**
|
|
90
|
+
* Waits for an element's position to stabilize by polling its position over time.
|
|
91
|
+
* This is useful for waiting for scroll animations or dynamic layout changes to complete.
|
|
92
|
+
*
|
|
93
|
+
* @param selector - The CSS selector for the element to monitor
|
|
94
|
+
* @param timeout - Maximum time to wait in milliseconds (default: 2000)
|
|
95
|
+
* @param checkInterval - How often to check position in milliseconds (default: 100)
|
|
96
|
+
* @param stabilityThreshold - Number of consecutive stable checks required (default: 3)
|
|
97
|
+
* @param tolerance - Maximum pixel difference to consider "stable" (default: 1)
|
|
98
|
+
*/
|
|
99
|
+
private _waitForElementPositionToStabilize;
|
|
100
|
+
waitForElementPositionToStabilize(selector: string, timeout?: number, checkInterval?: number, stabilityThreshold?: number, tolerance?: number): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Check if element is within the viewport (with some tolerance)
|
|
103
|
+
*/
|
|
104
|
+
private _isElementInViewport;
|
|
55
105
|
type(selector: string, text: string, options?: {
|
|
56
106
|
delay?: number;
|
|
57
107
|
}): Promise<void>;
|
|
@@ -110,6 +160,27 @@ export default class CdpPage extends EventEmitter {
|
|
|
110
160
|
*/
|
|
111
161
|
private _enableDomain;
|
|
112
162
|
reconnectSession(retries?: number): Promise<void>;
|
|
163
|
+
/**
|
|
164
|
+
* Selects one or more options from a select element or dropdown.
|
|
165
|
+
* Supports both regular select elements and virtualized dropdowns with hidden options.
|
|
166
|
+
*
|
|
167
|
+
* @param selector - The CSS selector for the select element or dropdown trigger
|
|
168
|
+
* @param targetSelector - CSS selector(s) for the option(s) to select. Can be a single selector or array of selectors
|
|
169
|
+
* @param options - Additional options for the selection
|
|
170
|
+
*/
|
|
171
|
+
selectOption(selector: string, targetSelector: string | string[], options?: SelectOptionOptions): Promise<void>;
|
|
172
|
+
/**
|
|
173
|
+
* Handles selection for regular HTML select elements
|
|
174
|
+
*/
|
|
175
|
+
private _handleRegularSelect;
|
|
176
|
+
/**
|
|
177
|
+
* Handles selection for custom dropdown elements
|
|
178
|
+
*/
|
|
179
|
+
private _handleCustomDropdown;
|
|
180
|
+
/**
|
|
181
|
+
* Selects a single option from a dropdown container, handling virtualized lists
|
|
182
|
+
*/
|
|
183
|
+
private _selectOptionFromDropdown;
|
|
113
184
|
/**
|
|
114
185
|
* Checks if the element specified by selector is visible (not display:none and not visibility:hidden).
|
|
115
186
|
* The selector should be the root item which can be hidden, otherwise this function could return a false positive.
|
package/dist/page.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../src/page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAGtC,OAAO,GAAG,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../src/page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAGtC,OAAO,GAAG,MAAM,yBAAyB,CAAC;AAwB1C,MAAM,WAAW,sBAAsB;IACnC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;I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