microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.4k stars 3.63k forks source link

[BUG] Unknown scheme for .initialize after upgrade .net #9592

Closed nl-dave closed 3 years ago

nl-dave commented 3 years ago

Context:

Code Snippet

class Program
    {
        static void Main(string[] args)
        {
            getPlaywright().GetAwaiter().GetResult();
        }
        static async Task getPlaywright()
        {
            await Playwright.CreateAsync();
        }
    }

Describe the bug

We've been using playwright 1.14.1 successfully for a while now. We recently went to upgrade the project to 1.15.4 and started getting "Unknown scheme for .initialize" on Playwright.CreateAsync(). We re-ran the npm and npx commands to reinstall playwright and still had the same issue. I created a blank project as seen above on 1.15.4 and saw the same issue. After rolling back to 1.14.1 everything worked as expected. .net c#

What did I miss in upgrading (or starting fresh) on 1.15.4?

pavelfeldman commented 3 years ago

What is your .net version? Is there a project you could share?

pavelfeldman commented 3 years ago

I tested it with net5.0 and net48 and things work fine for me. I followed these steps: https://playwright.dev/dotnet/docs/next/intro#first-project

nl-dave commented 3 years ago

This current project is targeting .net 4.7.2.

nl-dave commented 3 years ago

Ok. I think I got it figured out. Leaving this here for the benefit of future search results.

We originally installed playwright through npm. Just updating the package using package manager in visual studio does not work as expected.

Installing the global playwright cli did not work initially due to a private nuget repo configured in nuget.config. Removed that, installed the CLI, installed the package in the solution through the dontent tool, ran the playwright install command. Restore the private repo in the config and everything seems to work as expected.