@iflyrpa/playwright 1.2.65-beta.1 → 1.2.65-beta.3

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 CHANGED
@@ -2557,7 +2557,7 @@ var __webpack_exports__ = {};
2557
2557
  RpaTask: ()=>RpaTask
2558
2558
  });
2559
2559
  const actions_namespaceObject = require("@iflyrpa/actions");
2560
- var package_namespaceObject = JSON.parse('{"i8":"1.2.65-beta.0"}');
2560
+ var package_namespaceObject = JSON.parse('{"i8":"1.2.65-beta.2"}');
2561
2561
  const external_node_fs_namespaceObject = require("node:fs");
2562
2562
  var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
2563
2563
  const external_node_path_namespaceObject = require("node:path");
@@ -5488,24 +5488,44 @@ app.on("window-all-closed", (e) => e.preventDefault());
5488
5488
  await electron.app.whenReady();
5489
5489
  const window1 = new electron.BrowserWindow({
5490
5490
  show: pageParams.show,
5491
- width: 1500,
5492
- height: 800,
5491
+ width: 1920,
5492
+ height: 1080,
5493
5493
  webPreferences: {
5494
5494
  nodeIntegration: false,
5495
5495
  contextIsolation: true,
5496
- sandbox: true
5496
+ sandbox: true,
5497
+ webSecurity: true,
5498
+ allowRunningInsecureContent: false,
5499
+ experimentalFeatures: false,
5500
+ disableBlinkFeatures: "AutomationControlled",
5501
+ javascript: true,
5502
+ enableBlinkFeatures: "AllowRunningInsecureContent"
5497
5503
  }
5498
5504
  });
5505
+ await window1.loadURL(pageParams.url, {
5506
+ userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
5507
+ });
5499
5508
  if (pageParams.cookies) {
5500
- const cookies = pageParams.cookies.map((cookie)=>({
5509
+ console.log(`准备设置${pageParams.cookies.length}个cookies`);
5510
+ console.log("第一个cookie:", pageParams.cookies[0]);
5511
+ for(let i = 0; i < pageParams.cookies.length; i++){
5512
+ const cookie = pageParams.cookies[i];
5513
+ let domain = null == cookie ? void 0 : cookie.domain;
5514
+ if (null == domain ? void 0 : domain.startsWith(".")) domain = domain.slice(1);
5515
+ const cookieWithUrl = {
5501
5516
  ...cookie,
5502
- url: (null == cookie ? void 0 : cookie.domain) ? `http${cookie.secure ? "s" : ""}://${cookie.domain}${cookie.path || ""}` : "",
5503
- expirationDate: cookie.expires || -1,
5504
- sameSite: "lax"
5505
- }));
5506
- await Promise.all(cookies.map((ck)=>electron.session.defaultSession.cookies.set(ck)));
5517
+ url: domain ? `http${cookie.secure ? "s" : ""}://${domain}${cookie.path || ""}` : ""
5518
+ };
5519
+ try {
5520
+ await electron.session.defaultSession.cookies.set(cookieWithUrl);
5521
+ console.log(`Cookie ${i + 1}/${pageParams.cookies.length} 设置成功: ${cookie.name}`);
5522
+ } catch (error) {
5523
+ console.error(`Cookie ${i + 1}/${pageParams.cookies.length} 设置失败: ${cookie.name}`, error);
5524
+ }
5525
+ }
5526
+ console.log("cookies设置完成");
5527
+ console.log("刷新页面以应用cookies");
5507
5528
  }
5508
- await window1.loadURL(pageParams.url);
5509
5529
  }, {
5510
5530
  pageParams
5511
5531
  })
package/dist/index.js CHANGED
@@ -2550,7 +2550,7 @@ function __webpack_require__(moduleId) {
2550
2550
  });
2551
2551
  };
2552
2552
  })();
2553
- var package_namespaceObject = JSON.parse('{"i8":"1.2.65-beta.0"}');
2553
+ var package_namespaceObject = JSON.parse('{"i8":"1.2.65-beta.2"}');
2554
2554
  function _define_property(obj, key, value) {
2555
2555
  if (key in obj) Object.defineProperty(obj, key, {
2556
2556
  value: value,
@@ -5464,24 +5464,44 @@ class Task {
5464
5464
  await electron.app.whenReady();
5465
5465
  const window1 = new electron.BrowserWindow({
5466
5466
  show: pageParams.show,
5467
- width: 1500,
5468
- height: 800,
5467
+ width: 1920,
5468
+ height: 1080,
5469
5469
  webPreferences: {
5470
5470
  nodeIntegration: false,
5471
5471
  contextIsolation: true,
5472
- sandbox: true
5472
+ sandbox: true,
5473
+ webSecurity: true,
5474
+ allowRunningInsecureContent: false,
5475
+ experimentalFeatures: false,
5476
+ disableBlinkFeatures: "AutomationControlled",
5477
+ javascript: true,
5478
+ enableBlinkFeatures: "AllowRunningInsecureContent"
5473
5479
  }
5474
5480
  });
5481
+ await window1.loadURL(pageParams.url, {
5482
+ userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
5483
+ });
5475
5484
  if (pageParams.cookies) {
5476
- const cookies = pageParams.cookies.map((cookie)=>({
5485
+ console.log(`准备设置${pageParams.cookies.length}个cookies`);
5486
+ console.log("第一个cookie:", pageParams.cookies[0]);
5487
+ for(let i = 0; i < pageParams.cookies.length; i++){
5488
+ const cookie = pageParams.cookies[i];
5489
+ let domain = null == cookie ? void 0 : cookie.domain;
5490
+ if (null == domain ? void 0 : domain.startsWith(".")) domain = domain.slice(1);
5491
+ const cookieWithUrl = {
5477
5492
  ...cookie,
5478
- url: (null == cookie ? void 0 : cookie.domain) ? `http${cookie.secure ? "s" : ""}://${cookie.domain}${cookie.path || ""}` : "",
5479
- expirationDate: cookie.expires || -1,
5480
- sameSite: "lax"
5481
- }));
5482
- await Promise.all(cookies.map((ck)=>electron.session.defaultSession.cookies.set(ck)));
5493
+ url: domain ? `http${cookie.secure ? "s" : ""}://${domain}${cookie.path || ""}` : ""
5494
+ };
5495
+ try {
5496
+ await electron.session.defaultSession.cookies.set(cookieWithUrl);
5497
+ console.log(`Cookie ${i + 1}/${pageParams.cookies.length} 设置成功: ${cookie.name}`);
5498
+ } catch (error) {
5499
+ console.error(`Cookie ${i + 1}/${pageParams.cookies.length} 设置失败: ${cookie.name}`, error);
5500
+ }
5501
+ }
5502
+ console.log("cookies设置完成");
5503
+ console.log("刷新页面以应用cookies");
5483
5504
  }
5484
- await window1.loadURL(pageParams.url);
5485
5505
  }, {
5486
5506
  pageParams
5487
5507
  })
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iflyrpa/playwright",
3
3
  "type": "module",
4
- "version": "1.2.65-beta.1",
4
+ "version": "1.2.65-beta.3",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "extract-zip": "^2.0.1",
29
29
  "loglevel": "^1.9.2",
30
30
  "@iflyrpa/pacote": "1.0.1",
31
- "@iflyrpa/actions": "2.0.0-beta.1",
31
+ "@iflyrpa/actions": "2.0.0-beta.3",
32
32
  "@iflyrpa/share": "0.0.18-beta.0"
33
33
  },
34
34
  "scripts": {