1

Trying with below code connecting Moon. Can someone please help me on this? Microsoft.Playwright.PlaywrightException: unable to verify the first certificate Using Playwright

Strack Trace:

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)

Code:

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);
ouflak
  • 2,458
  • 10
  • 44
  • 49
  • What is moon? I can't find any reference to it. – hardkoded Mar 04 '22 at 14:54
  • 1
    Moon is a browser automation solution compatible with Selenium, Cypress, Playwright and Puppeteer using Kubernetes or Openshift to launch browsers. https://aerokube.com/moon/latest/ – shivkumar biradar Mar 08 '22 at 07:58
  • i have similar probleme on https://stackoverflow.com/questions/75003608/c-sharp-dotnet-why-websocket-unable-to-get-local-issuer-certificate any help please ? – Mohamed Jan 04 '23 at 09:57

1 Answers1

0

I hit the same issue recently.

  1. The error you are getting means that the certificates presented by the moon server to your client is incomplete. Try to provide the full chain of certs there!
  2. If later, you get the "WebSocket error: self signed certificate in certificate chain" then you need to set the NODE_EXTRA_CA_CERTS env variable pointing at your pem file. This is happening being Node cannot read the trusted CAs by default.

This is the question/solution I posted for the Playwright team along with the resolution.

  • i have similar probleme on https://stackoverflow.com/questions/75003608/c-sharp-dotnet-why-websocket-unable-to-get-local-issuer-certificate any help please ? – Mohamed Jan 04 '23 at 09:58