Giter Site home page Giter Site logo

Comments (1)

mxschmitt avatar mxschmitt commented on May 22, 2024

I tried to reproduce it by using a new Python Docker container, installing pytest and playwright-pytest and creating a small test file. Then running pytest without calling python -m playwright install before. It lead to the following output which is in my mind enough for the users who didn't install the browsers:

root@6468629fb07d:/# pytest test_foo.py
=========================================================================================== test session starts ============================================================================================
platform linux -- Python 3.9.0, pytest-6.1.2, py-1.9.0, pluggy-0.13.1
rootdir: /
plugins: base-url-1.4.2, playwright-0.0.7
collected 1 item                                                                                                                                                                                           

test_foo.py E                                                                                                                                                                                        [100%]

================================================================================================== ERRORS ==================================================================================================
___________________________________________________________________________ ERROR at setup of test_example_is_working[chromium] ____________________________________________________________________________

self = <playwright.browser_type.BrowserType object at 0x7f4205b85f40>, executablePath = None, args = None, ignoreDefaultArgs = None, handleSIGINT = None, handleSIGTERM = None, handleSIGHUP = None
timeout = None, env = None, headless = None, devtools = None, proxy = None, downloadsPath = None, slowMo = None, chromiumSandbox = None, firefoxUserPrefs = None

    async def launch(
        self,
        executablePath: Union[str, Path] = None,
        args: List[str] = None,
        ignoreDefaultArgs: Union[bool, List[str]] = None,
        handleSIGINT: bool = None,
        handleSIGTERM: bool = None,
        handleSIGHUP: bool = None,
        timeout: int = None,
        env: Env = None,
        headless: bool = None,
        devtools: bool = None,
        proxy: ProxyServer = None,
        downloadsPath: Union[str, Path] = None,
        slowMo: int = None,
        chromiumSandbox: bool = None,
        firefoxUserPrefs: Dict[str, Union[str, int, bool]] = None,
    ) -> Browser:
        params = locals_to_params(locals())
        normalize_launch_params(params)
        try:
>           return from_channel(await self._channel.send("launch", params))

usr/local/lib/python3.9/site-packages/playwright/browser_type.py:69: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <playwright.connection.Channel object at 0x7f4205b85fa0>, method = 'launch', params = {}

    async def send(self, method: str, params: Dict = None) -> Any:
        if params is None:
            params = {}
        callback = self._connection._send_message_to_server(self._guid, method, params)
>       result = await callback.future
E       playwright.helper.Error: Failed to launch chromium because executable doesn't exist at /root/.cache/ms-playwright/chromium-815036/chrome-linux/chrome
E       Try re-installing playwright with "npm install playwright"
E       Note: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.

usr/local/lib/python3.9/site-packages/playwright/connection.py:39: Error

During handling of the above exception, another exception occurred:

launch_browser = <function launch_browser.<locals>.launch at 0x7f4205c6b310>

    @pytest.fixture(scope="session")
    def browser(launch_browser: Callable[[], Browser]) -> Generator[Browser, None, None]:
>       browser = launch_browser()

usr/local/lib/python3.9/site-packages/pytest_playwright/pytest_playwright.py:113: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
usr/local/lib/python3.9/site-packages/pytest_playwright/pytest_playwright.py:98: in launch
    browser = getattr(pw, browser_name).launch(**launch_options)
usr/local/lib/python3.9/site-packages/playwright/sync_api.py:6142: in launch
    self._sync(
usr/local/lib/python3.9/site-packages/playwright/sync_base.py:107: in _sync
    return future.result()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <playwright.browser_type.BrowserType object at 0x7f4205b85f40>, executablePath = None, args = None, ignoreDefaultArgs = None, handleSIGINT = None, handleSIGTERM = None, handleSIGHUP = None
timeout = None, env = None, headless = None, devtools = None, proxy = None, downloadsPath = None, slowMo = None, chromiumSandbox = None, firefoxUserPrefs = None

    async def launch(
        self,
        executablePath: Union[str, Path] = None,
        args: List[str] = None,
        ignoreDefaultArgs: Union[bool, List[str]] = None,
        handleSIGINT: bool = None,
        handleSIGTERM: bool = None,
        handleSIGHUP: bool = None,
        timeout: int = None,
        env: Env = None,
        headless: bool = None,
        devtools: bool = None,
        proxy: ProxyServer = None,
        downloadsPath: Union[str, Path] = None,
        slowMo: int = None,
        chromiumSandbox: bool = None,
        firefoxUserPrefs: Dict[str, Union[str, int, bool]] = None,
    ) -> Browser:
        params = locals_to_params(locals())
        normalize_launch_params(params)
        try:
            return from_channel(await self._channel.send("launch", params))
        except Exception as e:
            if f"{self.name}-" in str(e):
>               raise not_installed_error(f'"{self.name}" browser was not found.')
E               Exception: 
E               ================================================================================
E               "chromium" browser was not found.
E               Please complete Playwright installation via running
E               
E                   "python -m playwright install"
E               
E               ================================================================================

usr/local/lib/python3.9/site-packages/playwright/browser_type.py:72: Exception
========================================================================================= short test summary info ==========================================================================================
ERROR test_foo.py::test_example_is_working[chromium] - Exception: 
============================================================================================= 1 error in 0.59s =============================================================================================
Exception in callback SyncBase._sync.<locals>.callback(<Task finishe...=========\n')>) at /usr/local/lib/python3.9/site-packages/playwright/sync_base.py:100
handle: <Handle SyncBase._sync.<locals>.callback(<Task finishe...=========\n')>) at /usr/local/lib/python3.9/site-packages/playwright/sync_base.py:100>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.9/site-packages/playwright/sync_base.py", line 101, in callback
    g_self.switch()
greenlet.GreenletExit

from playwright-pytest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.