【问题标题】:playwright firefox.launchPersistentContext timeout剧作家 firefox.launchPersistentContext 超时
【发布时间】:2022-11-04 02:28:03
【问题描述】:

我想使用基于会话目录的 playwright firefox 打开一个上下文,在我的电脑上,它运行良好,但是在 3 个不同的远程桌面连接电脑(vps windows 服务器)上出现错误。浏览器在 30 秒后打开,显示错误:

browserType.launchPersistentContext: Timeout 30000ms exceeded.
=========================== logs ===========================
<launching> C:\Users\Administrator\AppData\Local\ms-playwright\firefox-1322\firefox\firefox.exe -no-remote -wait-for-browser -foreground -profile ./browser_data/thread-test -juggler-pipe about:blank
<launched> pid=924
[pid=924][out]
[pid=924][out] Juggler listening to the pipe
[pid=924][err] IPDL protocol Error: Received an invalid file descriptor
[pid=924][err] IPDL protocol Error: Received an invalid file descriptor
[pid=924][err] IPDL protocol Error: Received an invalid file descriptor
============================================================
    at async C:\Users\Administrator\Desktop\gen\index.js:128:23 {
  name: 'TimeoutError'
}

error image

我使用的代码:

const {firefox} = require('playwright')
const context = await firefox.launchPersistentContext('./browser_data/thread-test', {headless:false,});

我认为将浏览器连接到剧作家步骤时出现错误,但我不知道如何修复...

谢谢您的帮助 !

【问题讨论】:

标签: node.js firefox playwright


【解决方案1】:
import { rm } from 'fs';
import { firefox } from 'playwright';


rm('/context/sessionstore-backups', () => {});
rm('/context/sessionCheckpoints.json', () => {});
rm('/context/sessionstore.jsonlz4', () => {});

context = await firefox.launchPersistentContext(
  '/context',
  { headless: false }
);
page = context.pages()[0];

【讨论】:

    【解决方案2】:

    实际上,我们需要删除userDataDir文件夹中的sessionstore-backupssessionstore.jsonlz4

    【讨论】:

      猜你喜欢
      • 2022-12-22
      • 2021-12-28
      • 2022-12-10
      • 1970-01-01
      • 2021-02-19
      • 2021-08-02
      • 2022-12-06
      • 1970-01-01
      • 2022-11-18
      相关资源
      最近更新 更多