首页 > 其他分享 >容器启动playwright报错TargetClosedError

容器启动playwright报错TargetClosedError

时间:2024-06-05 17:33:42浏览次数:27  
标签:playwright -- sandboxing disable 报错 Chromium TargetClosedError 1.42

运行环境

docker: Docker version 24.0.5, build 24.0.5-0ubuntu1~22.04.1
ubuntu: 22.04
playwright image: itisfoundation/osparc-playwright-e2e:2024-05
maven image: maven:3.8.5-openjdk-17-slim

报错信息

Caused by: com.microsoft.playwright.impl.TargetClosedError: Error {
  message='Target page, context or browser has been closed
Browser logs:
Chromium sandboxing failed!
================================
To workaround sandboxing issues, do either of the following:
  - (preferred): Configure environment to support sandboxing: https://playwright.dev/docs/troubleshooting
  - (alternative): Launch Chromium without sandbox using 'chromiumSandbox: false' option
================================

  name='TargetClosedError
  stack='TargetClosedError: Target page, context or browser has been closed
Browser logs:
Chromium sandboxing failed!
================================
To workaround sandboxing issues, do either of the following:
  - (preferred): Configure environment to support sandboxing: https://playwright.dev/docs/troubleshooting
  - (alternative): Launch Chromium without sandbox using 'chromiumSandbox: false' option
================================

    at DispatcherConnection.dispatch (/tmp/playwright-java-16072242212041617245/package/lib/server/dispatchers/dispatcher.js:379:15)
}
Call log:
- <launching> /ms-playwright/chromium-1105/chrome-linux/chrome --disable-field-trial-config --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate,HttpsUpgrades,PaintHolding --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --disable-search-engine-choice-screen --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --proxy-server=http://127.0.0.1:10809 --proxy-bypass-list=<-loopback> --user-data-dir=/tmp/playwright_chromiumdev_profile-bVtNIz --remote-debugging-pipe --no-startup-window
- <launched> pid=900
- [pid=900][err] [0604/094626.949594:ERROR:zygote_host_impl_linux.cc(100)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

        at com.microsoft.playwright.impl.Connection.dispatch(Connection.java:256) ~[playwright-1.42.0.jar!/:1.42.0]
        at com.microsoft.playwright.impl.Connection.processOneMessage(Connection.java:211) ~[playwright-1.42.0.jar!/:1.42.0]
        at com.microsoft.playwright.impl.ChannelOwner.runUntil(ChannelOwner.java:118) ~[playwright-1.42.0.jar!/:1.42.0]
        ... 56 common frames omitted

问题分析

报错中有“Chromium sandboxing failed!”字样,推测是该配置问题。
检查配置发现,代码中将ChromiumSandbox配置设为了true,尝试修改为false后可以正常运行。
所以说,该运行环境不支持Chromium的沙箱配置。

解决方案

将配置ChromiumSandbox配置为false即可。

已经向官方提issue,等待后续更新。

参考

[1] playwright docker doc

[2] microsoft-playwright-java image

标签:playwright,--,sandboxing,disable,报错,Chromium,TargetClosedError,1.42
From: https://www.cnblogs.com/bloodcolding/p/18233453

相关文章

  • React刷新页面报错(404)
    报错原因:你在浏览器内可以由首页跳转到其他路由地址,是因为这是由前端自行渲染的,你在ReactRouter定义了对应的路由,脚本并没有刷新网页访问后台,是JS动态更改了location。当刷新时,首先是访问的后台地址,然后返回的页面内加载了React代码,最后在浏览器内执行;也就是说如果这个时候报40......
  • npm下载依赖报错:operation not permitted
    npm下载依赖报错:operationnotpermitted想下个SoybeanAdmin来用下,需要用到pnpm,但是用npm下载的时候直接报错简单来说就是权限的问题,网上很多都说改nodejs下面的几个文件夹的权限,我的评价是不好使,还得修改nodejs这个文件夹的权限才行,右键属性-安全-编辑-勾上完全控制-确定,这样......
  • `jsonb` 报错 `invalid input syntax for type timestamp with time zone ““
    哈喽,大家好,我是木头左!大家好,我是你们的朋友,公众号博主。今天要聊一聊一个常见的数据库问题:jsonb报错invalidinputsyntaxfortypetimestampwithtimezone:""。这个问题可能会影响到你的开发工作,但是别担心,我会用最简单易懂的方式,帮助你解决这个问题。1.问题解析需要......
  • 服务器安装centos系统报错
    安装centos报错:dracut-initqueue:warning:dracut-initqueuetimeout-startingtimeoutscripts解决方法U盘启动报错信息 查看U盘的对应分区 重启电脑按e进入编辑模式将:vmlinuzinitrd=initrd.imginst.stage2=hd:LABEL=CentOS\x207\x20x86_64rd.live.checkquiet改......
  • ltp模型报错 model no loded
     打印了一下路径。莫名奇妙的路径,在网上找了很久的答案,丢是说这个路径的符号有问题改一下试试吧 后面有查到说的是不能中文路径,我觉得很奇怪,因为我新建了一个test文件来测试,那个文件中的模型路径采用的是当前的文件路径:并且运行成功了但是我在想,他会不会因为我这个项目里面......
  • .netCore System.Drawing.Common 发布,在CentOS 运行报错,生成图片流时。会因为不支持在
    报错:System.PlatformNotSupportedException:System.Drawing.Commonisnotsupportedonnon-Windowsplatforms.Seehttps://aka.ms/systemdrawingnonwindowsformoreinformation. >System.PlatformNotSupportedException:System.Drawing.Commonisnotsupported......
  • git clone GitHub 仓库报错未授权
    gitcloneGitHub仓库报错未授权grantGithubauthenticationtogitCreated:2024-06-03T20:40+08:00Published:2024-06-03T20:44+08:00Categories:GitGitHub开启双重认证以后,就不能只依靠GitHub的账号密码来gitclonerepo了。这里提供一种方法,安装GithubComman......
  • react 报错 元素隐式具有 "any" 类型,因为类型为 "string" 的表达式不能用于索引类型 "
    interfaceitemType{legoBlockId:string;legoBlockNumber:string;//其他属性...}colorListAll().then((res:{result:Array<itemType>})=>{//使用Record<string,any>或更具体的类型(如果已知)constdic:Record<string,any&......
  • 安装jsonpath时报错: ERROR: Could not find a version that satisfies the requireme
    安装jsonpath时报错:ERROR:Couldnotfindaversionthatsatisfiestherequirementjsonpath(fromversions:none)ERROR:Nomatchingdistributionfoundforjsonpath解决方法:pipinstalljsonpath-i http://mirrors.aliyun.com/pypi/simple/--trusted-hostmirrors.......
  • pytest运行报错:UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xaf in posit
    pytest运行报错:UnicodeDecodeError:‘gbk’codeccan’tdecodebyte0xafinposition82:illegalmultibytesequence  D:\Python\environment\python3.9.7\python3.exeD:/Python/nas_autotest/run.pyTraceback(mostrecentcalllast):File"D:\Python\......