diff --git a/pytest_playwright/pytest_playwright.py b/pytest_playwright/pytest_playwright.py index f5c8ec4..7fe0fb0 100644 --- a/pytest_playwright/pytest_playwright.py +++ b/pytest_playwright/pytest_playwright.py @@ -220,7 +220,12 @@ def browser(launch_browser: Callable[[], Browser]) -> Generator[Browser, None, N browser = launch_browser() yield browser browser.close() - artifacts_folder.cleanup() + try: + # On Windows, files can be still in use. + # https://github.com/microsoft/playwright-pytest/issues/163 + artifacts_folder.cleanup() + except (PermissionError, NotADirectoryError): + pass @pytest.fixture