microsoft / playwright-dotnet

.NET version of the Playwright testing and automation library.
https://playwright.dev/dotnet/
MIT License
2.47k stars 235 forks source link

[Question]: Why does DotNet require browser Install when Java version downloads on demand? #1957

Closed neil-hudson-SQC closed 2 years ago

neil-hudson-SQC commented 2 years ago

Your question

I am evaluating Playwright as a tool for use in mixed language development organisation. So far, I have setup both Java and DotNet variants to experiment with. I noticed a significant difference in behaviour.

  1. The Java variant does not require installation of the browsers. Instead when the test program is started it downloads them on demand.
  2. In the DotNet case, if the Install process has not been executed then execution the test program fails, it does not perform an on-demand download. The browsers have to be installed using pwsh bin\Debug\netX\playwright.ps1 install

Can you clarify the rational for the difference? Is there a technical barrier to having, as an option, download at the time of execution (as implemented in the Java variant)? Is the difference based on the DotNet team taking a position on how runtimes should be setup for test execution?

mxschmitt commented 2 years ago

We'll expose a API to install the browsers soon: #1959.

The reason for that is that not always a user wants to have all browsers installed. Sometimes they e.g. just want to do BrowserType.ConnectOverCDPAsync which does not require any browser to be downloaded when the CDP instance is externally.

Why Java is doing it? More a historical decision which we would do differently nowadays.