尝试使用以下代码连接Moon。有人能帮我吗?Microsoft.Playwright.PlaywrightException: unable to verify the first certificate Using Playwright
杂散跟踪:
onnection.SendMessageToServerAsync[T](String guid, String method, Object args)
BrowserType.ConnectAsync(String wsEndpoint, BrowserTypeConnectOptions options)
MoonDotNetCore.InitiateMoonWebDriver() line 68
GenericAdapter`1.BlockUntilCompleted()
NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaitable)
AsyncToSyncAdapter.Await(Func`1 invoke)
SetUpTearDownItem.RunSetUpOrTearDownMethod(TestExecutionContext context, MethodInfo method)
SetUpTearDownItem.RunSetUp(TestExecutionContext context)
<.ctor>b__0(TestExecutionContext context)
<>c__DisplayClass1_0.<Execute>b__0()
BeforeAndAfterTestCommand.RunTestMethodInThreadAbortSafeZone(TestExecutionContext context, Action action)
代码:
Dictionary<string, string> moonOptions = new Dictionary<string, string>();
moonOptions.Add("Http","--ignore-certificate-errors");
BrowserTypeConnectOptions launchOptions = new BrowserTypeConnectOptions() {
Headers = moonOptions
};
var playwright = await Playwright.CreateAsync();
await playwright.Chromium.ConnectAsync("wss://moon.url.com/wd/hub", launchOptions);
我最近遇到了同样的问题。
- 您收到的错误意味着moon服务器向您的客户端提供的证书不完整。尝试在那里提供完整的证书链
- 如果稍后;WebSocket错误:证书链中的自签名证书";则需要设置指向pem文件的NODE_EXTRA_CERTS env变量。发生这种情况的原因是节点默认情况下无法读取受信任的CA
这是我为剧作家团队发布的问题/解决方案以及解决方案。