@skrillex1224/playwright-toolkit 3.0.31 → 3.0.33

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.js CHANGED
@@ -2396,6 +2396,7 @@ async function createApifyKit() {
2396
2396
  }
2397
2397
  const { Actor: Actor2 } = apify;
2398
2398
  const actorInput = await Actor2.getInput() || {};
2399
+ const isDebugMode = Boolean(actorInput.debugMode || actorInput.debug_mode);
2399
2400
  let lastPage = null;
2400
2401
  const getRuntimeContext = () => resolveRuntimeContext(actorInput);
2401
2402
  return {
@@ -2472,6 +2473,14 @@ async function createApifyKit() {
2472
2473
  const finalError = lastResult.error;
2473
2474
  if (failActor) {
2474
2475
  let base64 = "\u622A\u56FE\u5931\u8D25";
2476
+ let html;
2477
+ if (isDebugMode && page) {
2478
+ try {
2479
+ html = await page.content();
2480
+ } catch (htmlErr) {
2481
+ logger3.warn(`HTML \u91C7\u96C6\u5931\u8D25: ${htmlErr.message}`);
2482
+ }
2483
+ }
2475
2484
  try {
2476
2485
  if (page) {
2477
2486
  const buffer = await capturePageScreenshot(page, {
@@ -2489,7 +2498,8 @@ async function createApifyKit() {
2489
2498
  {
2490
2499
  step,
2491
2500
  base64,
2492
- retryAttempts: retryTimes
2501
+ retryAttempts: retryTimes,
2502
+ ...html ? { html } : {}
2493
2503
  },
2494
2504
  {
2495
2505
  page,
@@ -2726,8 +2736,7 @@ var methodDescriptor = (namespace, name, resolveTarget) => ({
2726
2736
  });
2727
2737
  var withModeReflect = (namespace, strategies = {}) => {
2728
2738
  const normalizedStrategies = normalizeStrategies2(strategies);
2729
- const baseStrategy = normalizedStrategies.default ?? Object.values(normalizedStrategies).find(Boolean);
2730
- const names = collectFunctionNames([baseStrategy]);
2739
+ const names = collectFunctionNames(Object.values(normalizedStrategies));
2731
2740
  const descriptors = {};
2732
2741
  for (const name of names) {
2733
2742
  descriptors[name] = methodDescriptor(namespace, name, () => resolveModeStrategy(normalizedStrategies));