@iflyrpa/playwright 1.2.65 → 1.2.67
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 +60 -13
- package/dist/index.js +60 -13
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -2557,7 +2557,9 @@ var __webpack_exports__ = {};
|
|
|
2557
2557
|
RpaTask: ()=>RpaTask
|
|
2558
2558
|
});
|
|
2559
2559
|
const actions_namespaceObject = require("@iflyrpa/actions");
|
|
2560
|
-
var package_namespaceObject =
|
|
2560
|
+
var package_namespaceObject = {
|
|
2561
|
+
i8: "1.2.66"
|
|
2562
|
+
};
|
|
2561
2563
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
2562
2564
|
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
2563
2565
|
const external_node_path_namespaceObject = require("node:path");
|
|
@@ -5488,24 +5490,69 @@ app.on("window-all-closed", (e) => e.preventDefault());
|
|
|
5488
5490
|
await electron.app.whenReady();
|
|
5489
5491
|
const window1 = new electron.BrowserWindow({
|
|
5490
5492
|
show: pageParams.show,
|
|
5491
|
-
width:
|
|
5492
|
-
height:
|
|
5493
|
+
width: 1920,
|
|
5494
|
+
height: 1080,
|
|
5493
5495
|
webPreferences: {
|
|
5494
5496
|
nodeIntegration: false,
|
|
5495
5497
|
contextIsolation: true,
|
|
5496
|
-
sandbox: true
|
|
5498
|
+
sandbox: true,
|
|
5499
|
+
webSecurity: true,
|
|
5500
|
+
allowRunningInsecureContent: false,
|
|
5501
|
+
experimentalFeatures: false,
|
|
5502
|
+
disableBlinkFeatures: "AutomationControlled",
|
|
5503
|
+
javascript: true,
|
|
5504
|
+
enableBlinkFeatures: "AllowRunningInsecureContent"
|
|
5497
5505
|
}
|
|
5498
5506
|
});
|
|
5499
|
-
if (pageParams.cookies) {
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
+
if (pageParams.cookies && pageParams.cookies.length > 0) {
|
|
5508
|
+
console.log(`准备设置${pageParams.cookies.length}个cookies`);
|
|
5509
|
+
for(let i = 0; i < pageParams.cookies.length; i++){
|
|
5510
|
+
const cookie = pageParams.cookies[i];
|
|
5511
|
+
let domain = (null == cookie ? void 0 : cookie.domain) || "";
|
|
5512
|
+
if (domain.startsWith(".")) domain = domain.slice(1);
|
|
5513
|
+
if (!domain) try {
|
|
5514
|
+
const urlObj = new URL(pageParams.url);
|
|
5515
|
+
domain = urlObj.hostname;
|
|
5516
|
+
} catch (e) {
|
|
5517
|
+
console.error(`无法从 URL 提取 domain: ${pageParams.url}`, e);
|
|
5518
|
+
continue;
|
|
5519
|
+
}
|
|
5520
|
+
const cookieWithUrl = {
|
|
5521
|
+
name: cookie.name,
|
|
5522
|
+
value: cookie.value,
|
|
5523
|
+
url: `http${cookie.secure ? "s" : ""}://${domain}${cookie.path || "/"}`,
|
|
5524
|
+
domain: domain,
|
|
5525
|
+
path: cookie.path || "/",
|
|
5526
|
+
secure: cookie.secure || false,
|
|
5527
|
+
httpOnly: cookie.httpOnly || false,
|
|
5528
|
+
expirationDate: cookie.expires
|
|
5529
|
+
};
|
|
5530
|
+
console.log(`设置 Cookie [${i + 1}/${pageParams.cookies.length}]:`, {
|
|
5531
|
+
name: cookieWithUrl.name,
|
|
5532
|
+
domain: cookieWithUrl.domain,
|
|
5533
|
+
url: cookieWithUrl.url,
|
|
5534
|
+
secure: cookieWithUrl.secure
|
|
5535
|
+
});
|
|
5536
|
+
try {
|
|
5537
|
+
await electron.session.defaultSession.cookies.set(cookieWithUrl);
|
|
5538
|
+
console.log(`✓ Cookie 设置成功: ${cookie.name}`);
|
|
5539
|
+
} catch (error) {
|
|
5540
|
+
console.error(`✗ Cookie 设置失败: ${cookie.name}`, error);
|
|
5541
|
+
console.error("Cookie 详情:", JSON.stringify(cookieWithUrl, null, 2));
|
|
5542
|
+
}
|
|
5543
|
+
}
|
|
5544
|
+
console.log("所有 cookies 设置完成");
|
|
5545
|
+
try {
|
|
5546
|
+
const allCookies = await electron.session.defaultSession.cookies.get({});
|
|
5547
|
+
console.log(`当前 session 中共有 ${allCookies.length} 个 cookies`);
|
|
5548
|
+
if (allCookies.length > 0) console.log("已设置的 cookies:", allCookies.map((c)=>`${c.name}@${c.domain}`).join(", "));
|
|
5549
|
+
} catch (e) {
|
|
5550
|
+
console.error("验证 cookies 失败:", e);
|
|
5551
|
+
}
|
|
5507
5552
|
}
|
|
5508
|
-
await window1.loadURL(pageParams.url
|
|
5553
|
+
await window1.loadURL(pageParams.url, {
|
|
5554
|
+
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
|
|
5555
|
+
});
|
|
5509
5556
|
}, {
|
|
5510
5557
|
pageParams
|
|
5511
5558
|
})
|
package/dist/index.js
CHANGED
|
@@ -2550,7 +2550,9 @@ function __webpack_require__(moduleId) {
|
|
|
2550
2550
|
});
|
|
2551
2551
|
};
|
|
2552
2552
|
})();
|
|
2553
|
-
var package_namespaceObject =
|
|
2553
|
+
var package_namespaceObject = {
|
|
2554
|
+
i8: "1.2.66"
|
|
2555
|
+
};
|
|
2554
2556
|
function _define_property(obj, key, value) {
|
|
2555
2557
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
2556
2558
|
value: value,
|
|
@@ -5464,24 +5466,69 @@ class Task {
|
|
|
5464
5466
|
await electron.app.whenReady();
|
|
5465
5467
|
const window1 = new electron.BrowserWindow({
|
|
5466
5468
|
show: pageParams.show,
|
|
5467
|
-
width:
|
|
5468
|
-
height:
|
|
5469
|
+
width: 1920,
|
|
5470
|
+
height: 1080,
|
|
5469
5471
|
webPreferences: {
|
|
5470
5472
|
nodeIntegration: false,
|
|
5471
5473
|
contextIsolation: true,
|
|
5472
|
-
sandbox: true
|
|
5474
|
+
sandbox: true,
|
|
5475
|
+
webSecurity: true,
|
|
5476
|
+
allowRunningInsecureContent: false,
|
|
5477
|
+
experimentalFeatures: false,
|
|
5478
|
+
disableBlinkFeatures: "AutomationControlled",
|
|
5479
|
+
javascript: true,
|
|
5480
|
+
enableBlinkFeatures: "AllowRunningInsecureContent"
|
|
5473
5481
|
}
|
|
5474
5482
|
});
|
|
5475
|
-
if (pageParams.cookies) {
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
+
if (pageParams.cookies && pageParams.cookies.length > 0) {
|
|
5484
|
+
console.log(`准备设置${pageParams.cookies.length}个cookies`);
|
|
5485
|
+
for(let i = 0; i < pageParams.cookies.length; i++){
|
|
5486
|
+
const cookie = pageParams.cookies[i];
|
|
5487
|
+
let domain = (null == cookie ? void 0 : cookie.domain) || "";
|
|
5488
|
+
if (domain.startsWith(".")) domain = domain.slice(1);
|
|
5489
|
+
if (!domain) try {
|
|
5490
|
+
const urlObj = new URL(pageParams.url);
|
|
5491
|
+
domain = urlObj.hostname;
|
|
5492
|
+
} catch (e) {
|
|
5493
|
+
console.error(`无法从 URL 提取 domain: ${pageParams.url}`, e);
|
|
5494
|
+
continue;
|
|
5495
|
+
}
|
|
5496
|
+
const cookieWithUrl = {
|
|
5497
|
+
name: cookie.name,
|
|
5498
|
+
value: cookie.value,
|
|
5499
|
+
url: `http${cookie.secure ? "s" : ""}://${domain}${cookie.path || "/"}`,
|
|
5500
|
+
domain: domain,
|
|
5501
|
+
path: cookie.path || "/",
|
|
5502
|
+
secure: cookie.secure || false,
|
|
5503
|
+
httpOnly: cookie.httpOnly || false,
|
|
5504
|
+
expirationDate: cookie.expires
|
|
5505
|
+
};
|
|
5506
|
+
console.log(`设置 Cookie [${i + 1}/${pageParams.cookies.length}]:`, {
|
|
5507
|
+
name: cookieWithUrl.name,
|
|
5508
|
+
domain: cookieWithUrl.domain,
|
|
5509
|
+
url: cookieWithUrl.url,
|
|
5510
|
+
secure: cookieWithUrl.secure
|
|
5511
|
+
});
|
|
5512
|
+
try {
|
|
5513
|
+
await electron.session.defaultSession.cookies.set(cookieWithUrl);
|
|
5514
|
+
console.log(`✓ Cookie 设置成功: ${cookie.name}`);
|
|
5515
|
+
} catch (error) {
|
|
5516
|
+
console.error(`✗ Cookie 设置失败: ${cookie.name}`, error);
|
|
5517
|
+
console.error("Cookie 详情:", JSON.stringify(cookieWithUrl, null, 2));
|
|
5518
|
+
}
|
|
5519
|
+
}
|
|
5520
|
+
console.log("所有 cookies 设置完成");
|
|
5521
|
+
try {
|
|
5522
|
+
const allCookies = await electron.session.defaultSession.cookies.get({});
|
|
5523
|
+
console.log(`当前 session 中共有 ${allCookies.length} 个 cookies`);
|
|
5524
|
+
if (allCookies.length > 0) console.log("已设置的 cookies:", allCookies.map((c)=>`${c.name}@${c.domain}`).join(", "));
|
|
5525
|
+
} catch (e) {
|
|
5526
|
+
console.error("验证 cookies 失败:", e);
|
|
5527
|
+
}
|
|
5483
5528
|
}
|
|
5484
|
-
await window1.loadURL(pageParams.url
|
|
5529
|
+
await window1.loadURL(pageParams.url, {
|
|
5530
|
+
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
|
|
5531
|
+
});
|
|
5485
5532
|
}, {
|
|
5486
5533
|
pageParams
|
|
5487
5534
|
})
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iflyrpa/playwright",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.67",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"@sentry/node": "^9.11.0",
|
|
28
28
|
"extract-zip": "^2.0.1",
|
|
29
29
|
"loglevel": "^1.9.2",
|
|
30
|
+
"@iflyrpa/actions": "2.0.1",
|
|
30
31
|
"@iflyrpa/pacote": "1.0.1",
|
|
31
|
-
"@iflyrpa/actions": "1.2.32",
|
|
32
32
|
"@iflyrpa/share": "0.0.18"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|