Giter Site home page Giter Site logo

microsoft / playwright-python Goto Github PK

View Code? Open in Web Editor NEW
10.7K 135.0 812.0 7.32 MB

Python version of the Playwright testing and automation library.

Home Page: https://playwright.dev/python/

License: Apache License 2.0

Python 99.00% JavaScript 0.12% HTML 0.70% CSS 0.01% Shell 0.17%
playwright chromium firefox webkit

playwright-python's Introduction

๐ŸŽญ Playwright for Python PyPI version Anaconda version Join Discord

Playwright is a Python library to automate Chromium, Firefox and WebKit browsers with a single API. Playwright delivers automation that is ever-green, capable, reliable and fast. See how Playwright is better.

Linux macOS Windows
Chromium 124.0.6367.29 โœ… โœ… โœ…
WebKit 17.4 โœ… โœ… โœ…
Firefox 124.0 โœ… โœ… โœ…

Documentation

https://playwright.dev/python/docs/intro

API Reference

https://playwright.dev/python/docs/api/class-playwright

Example

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    for browser_type in [p.chromium, p.firefox, p.webkit]:
        browser = browser_type.launch()
        page = browser.new_page()
        page.goto('http://playwright.dev')
        page.screenshot(path=f'example-{browser_type.name}.png')
        browser.close()
import asyncio
from playwright.async_api import async_playwright

async def main():
    async with async_playwright() as p:
        for browser_type in [p.chromium, p.firefox, p.webkit]:
            browser = await browser_type.launch()
            page = await browser.new_page()
            await page.goto('http://playwright.dev')
            await page.screenshot(path=f'example-{browser_type.name}.png')
            await browser.close()

asyncio.run(main())

Other languages

More comfortable in another programming language? Playwright is also available in

playwright-python's People

Contributors

abr-storm avatar adamchainz avatar alberlc avatar amotl avatar arjunattam avatar artyl avatar aslushnikov avatar avodovnik avatar axelande avatar bo5o avatar danphenderson avatar dependabot[bot] avatar dgozman avatar itslewin avatar jcheng5 avatar kianmeng avatar kumaraditya303 avatar lironharoni avatar m9810223 avatar marketionist avatar mattwmaster58 avatar mickmcc avatar microsoftopensource avatar mxschmitt avatar pavelfeldman avatar razerm avatar rwoll avatar tumregels avatar x0day avatar yury-s avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

playwright-python's Issues

[API] expose selectors

playwright.selectors is not yet exposed, should be doable after the next Playwright roll

Audit Playwright stdio

We currently use stdout/stdin for the transport Pipes. Make sure Playwright keeps them silent and does not do console.err or process.stderr writes in the server mode.

`ignoreDefaultArgs` launch parameter is broken

I'm trying to disable default launch arguments however when this parameter is set to True one of two things happen:

browser: Browser = chromium.launch(ignoreDefaultArgs=True)

will break with:

  File "/home/user/.local/lib/python3.8/site-packages/playwright/browser_type.py", line 66, in launch
    normalize_launch_params(params)
  File "/home/user/.local/lib/python3.8/site-packages/playwright/browser_type.py", line 140, in normalize_launch_params
    params["env"] = {name: str(value) for [name, value] in params["env"].items()}
KeyError: 'env'

I've made a hotfix patch here Granitosaurus@2dc0e10 now the browser launches fine but timesout on launch() call:

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.8/site-packages/playwright/browser_type.py", line 68, in launch
    return from_channel(await self._channel.send("launch", params))
  File "/home/user/.local/lib/python3.8/site-packages/playwright/connection.py", line 39, in send
    result = await callback.future
  File "/usr/lib/python3.8/asyncio/futures.py", line 260, in __await__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.8/asyncio/tasks.py", line 349, in __wakeup
    future.result()
  File "/usr/lib/python3.8/asyncio/futures.py", line 178, in result
    raise self._exception
playwright.helper.TimeoutError: Timeout 30000ms exceeded.
=========================== logs ===========================
<launching> /home/user/.cache/ms-playwright/chromium-799411/chrome-linux/chrome 
<launched> pid=301672
[err] [301699:301699:0914/061714.839670:ERROR:sandbox_linux.cc(374)] InitializeSandbox() called with multiple threads in process gpu-process.

Download driver from CDN

  • move driver into upstream repo
  • Setup driver CDN microsoft/playwright#3503
  • once python -m playwright install will get executed the driver gets downloaded first which installs then the browsers #172

We internally just have a constant for the version which we are using

Downstream test organization

The idea is that our downstream tests will be 1:1 to our upstream tests:

  • We will convert all the test names to pytest identifiers test_foo using canonical name conversion (replacing all non-identifier characters with _)
  • We will keep them in the files named similarly to upstream, foo.spec.js -> test_foo.py
  • For tests that we don't think are worth porting, we will have pass in them and a 1-line comment suggesting that we don't want to port this test

We should be able to run a script that would tell us how many tests are not yet ported relative to the upstream state

[Question] How Start multiple browser in parallel with threading?

from playwright import sync_playwright
import threading

def start_browser(browser_type):
    browser = browser_type.launch(headless=False)
    page = browser.newPage()
    page.goto('http://whatsmyuseragent.org/')
    page.screenshot(path=f'example-{browser_type.name}.png')
    browser.close()
    
def main():
    with sync_playwright() as p:
        threads = []
        for browser_type in [p.chromium, p.firefox, p.webkit]:
            t = threading.Thread(target=start_browser, args=(browser_type,))
            t.start()
            threads.append(t)
        for t in threads:
            t.join()    

if __name__ == '__main__':
    main()

greenlet.error: cannot switch to a different thread

Source code has no docstrings

I'm trying to learn some of playwrights internals but it's really hard to follow when none of the code has any documentation. Is it stored somewhere else or the project just doesn't have anything implemented just yet?

[BUG]: page.getAttribute returns None

Actual:

import asyncio
from playwright_web import chromium


async def run():
    browser = await chromium.launch(headless=False)
    context = await browser.newContext(viewport=0)  # 0 stands for no viewport
    page = await context.newPage()

    await page.setContent(""""
    <input id="kekstar"/>
    """)

    await page.fill("#kekstar", "Foobar")

    print(await page.getAttribute("#kekstar", 'value'))

    await browser.close()


asyncio.get_event_loop().run_until_complete(run())

Expected: Returns Foobar

On Try Playwright, it works: https://try.playwright.tech/?s=dzmwi

[Improvement] "Unresolved attribute reference 'stop' for classes SyncPlaywrightContextManager/ AsyncPlaywrightContextManager appears in IDE

When to use "REPL support without context managers", IDE shows inspection warning "Unresolved attribute reference 'stop' for classes SyncPlaywrightContextManager (for Async too).
It's because stop is registered not obviously, e.g. in line 96: playwright.stop = self.exit # type: ignore
It's better to implement the same solution for stop() as with start()
OR
if to change e.g. in SyncPlaywrightContextManager:

  1. delete def start(self)
  2. delete playwright.stop = self.exit # type: ignore (line 97)
  3. in the end of the class after exit add:
start = __enter__
stop = __exit__
  1. line 96 playwright = self._playwright also seems not needed and can be deleted.

the 'Unresolved attribute reference' inspection in IDE will be fixed and everything will work as expected.
The same changes may be applied for Async for start/stop.

Stdout/stderr pipe throws stacktrace if stdout/stderr is mocked by Pytest

I think more an upstream issue (here) instead of for the Pytest plugin.

Stacktrace:

pytest project-name/browser_tests --browser chromium --base-url http://localhost:8000/
============================= test session starts ==============================
platform linux -- Python 3.8.5, pytest-6.0.1, py-1.9.0, pluggy-0.13.1
baseurl: http://localhost:8000/
django: settings: config.settings.test (from option)
Using --randomly-seed=1
rootdir: /home/runner/work/project-name/project-name, configfile: setup.cfg
plugins: freezegun-0.4.2, base-url-1.4.2, playwright-0.0.5, cov-2.10.0, sugar-0.9.4, django-3.9.0, randomly-3.4.1, celery-4.4.7, factoryboy-2.0.3, Faker-4.1.1, env-0.6.2
collected 15 items

project-name/browser_tests/test_internal_manager_dashboard.py E [  6%]


==================================== ERRORS ====================================
_ ERROR at setup of test123[chromium] _

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

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

/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/pytest_playwright/pytest_playwright.py:114: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/pytest_playwright/pytest_playwright.py:97: in launch
    pw_context = sync_playwright()
/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/playwright/__init__.py:27: in sync_playwright
    return SyncPlaywrightContextManager()
/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/playwright/main.py:72: in __init__
    self._connection = run_driver()
/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/playwright/main.py:67: in run_driver
    return loop.run_until_complete(run_driver_async())
/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/asyncio/base_events.py:616: in run_until_complete
    return future.result()
/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/playwright/main.py:48: in run_driver_async
    proc = await asyncio.create_subprocess_exec(
/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/asyncio/subprocess.py:236: in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/asyncio/base_events.py:1630: in subprocess_exec
    transport = await self._make_subprocess_transport(
/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/asyncio/unix_events.py:197: in _make_subprocess_transport
    transp = _UnixSubprocessTransport(self, protocol, args, shell,
/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/asyncio/base_subprocess.py:36: in __init__
    self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/asyncio/unix_events.py:789: in _start
    self._proc = subprocess.Popen(
/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/subprocess.py:804: in __init__
    errread, errwrite) = self._get_handles(stdin, stdout, stderr)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <subprocess.Popen object at 0x7f6bc73dfa60>
stdin = <socket.socket [closed] fd=-1, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
stdout = -1, stderr = <_io.TextIOWrapper encoding='UTF-8'>

    def _get_handles(self, stdin, stdout, stderr):
        """Construct and return tuple with IO objects:
        p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
        """
        p2cread, p2cwrite = -1, -1
        c2pread, c2pwrite = -1, -1
        errread, errwrite = -1, -1
    
        if stdin is None:
            pass
        elif stdin == PIPE:
            p2cread, p2cwrite = os.pipe()
        elif stdin == DEVNULL:
            p2cread = self._get_devnull()
        elif isinstance(stdin, int):
            p2cread = stdin
        else:
            # Assuming file-like object
            p2cread = stdin.fileno()
    
        if stdout is None:
            pass
        elif stdout == PIPE:
            c2pread, c2pwrite = os.pipe()
        elif stdout == DEVNULL:
            c2pwrite = self._get_devnull()
        elif isinstance(stdout, int):
            c2pwrite = stdout
        else:
            # Assuming file-like object
            c2pwrite = stdout.fileno()
    
        if stderr is None:
            pass
        elif stderr == PIPE:
            errread, errwrite = os.pipe()
        elif stderr == STDOUT:
            if c2pwrite != -1:
                errwrite = c2pwrite
            else: # child's stdout is not set, use parent's stdout
                errwrite = sys.__stdout__.fileno()
        elif stderr == DEVNULL:
            errwrite = self._get_devnull()
        elif isinstance(stderr, int):
            errwrite = stderr
        else:
            # Assuming file-like object
>           errwrite = stderr.fileno()
E           io.UnsupportedOperation: fileno

/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/subprocess.py:1504: UnsupportedOperation
---------------------------- Captured stdout setup -----------------------------
kektus <_io.TextIOWrapper encoding='UTF-8'>
=========================== short test summary info ============================
ERROR project-name/browser_tests/test123.py::test123[chromium]
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.67s ===============================
Makefile:23: recipe for target 'browser_test' failed

Using the -s parameter is a workaround for that. Issue is persistent since #145.

Authentication Proxy doesn't work

I tried running playwright with authentication proxy and got warning and it doesn't work:
warning: method |context.setHTTPCredentials()| is deprecated. Instead of changing credentials, create another browser context with new credentials.
Here my code:

with sync_playwright() as p:
    browser = p.webkit.launch(headless=False, proxy={
        "server": 'http://server.com:80',
        'username': 'My_user',
        "password": 'My_password',
    })
    context = browser.newContext()
    page = context.newPage()
    page.goto('https://whoer.net')
    page.screenshot(path='whoer.png')
    browser.close()

[CLI] Option to install specific version of browsers

Right now the only way to change browser version is to manually edit the site-packages/playwright/drivers/browsers.json. Would be great if that version could be supplied to install command as a flag.

e.g.

$ python -m playwright install --chromium-version=798026
or through environment variable
$ export PLAYWRIGHT_CHROMIUM_VERSION=798026
$ python -m playwright install

Release blocker list

  • Implementation:
    • Add missing methods as reported by the generators
    • Implement / integrate loggers
  • Tests coverage:
    • Convert tests to the Python world #7 WIP
    • Mirror async tests into sync Python world
  • Documentation:
    • Process api.md to feel native to Python
    • Provide patterns in the sync vs. the async world.

"RuntimeError: This event loop is already running" When attempting REPL example

Each time I attempt the REPl example, I get the traceback below. Sync context-manager example worked though.
playwright==0.8.0
REPL Example: https://github.com/microsoft/playwright-python#repl-support-without-context-managers

IPython session

ย jakeย ๎‚ฐย (e)ย venvplaywrightย ๎‚ฐย ~ย ๎‚ฐย ipython
/home/jake/.local/lib/python3.8/site-packages/IPython/core/interactiveshell.py:935: UserWarning: Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv.
  warn("Attempting to work in a virtualenv. If you encounter problems, please "
Python 3.8.3 (default, May 29 2020, 00:00:00) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.13.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from playwright import sync_playwright                                                                                                                                                

In [2]: playwright = sync_playwright().start()                                                                                                                                                

Traceback (most recent call last):
  File "/usr/local/bin/ipython", line 11, in <module>
    sys.exit(start_ipython())
  File "/home/jake/.local/lib/python3.8/site-packages/IPython/__init__.py", line 126, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/home/jake/.local/lib/python3.8/site-packages/traitlets/config/application.py", line 664, in launch_instance
    app.start()
  File "/home/jake/.local/lib/python3.8/site-packages/IPython/terminal/ipapp.py", line 356, in start
    self.shell.mainloop()
  File "/home/jake/.local/lib/python3.8/site-packages/IPython/terminal/interactiveshell.py", line 558, in mainloop
    self.interact()
  File "/home/jake/.local/lib/python3.8/site-packages/IPython/terminal/interactiveshell.py", line 541, in interact
    code = self.prompt_for_code()
  File "/home/jake/.local/lib/python3.8/site-packages/IPython/terminal/interactiveshell.py", line 467, in prompt_for_code
    text = self.pt_app.prompt(
  File "/home/jake/.local/lib/python3.8/site-packages/prompt_toolkit/shortcuts/prompt.py", line 994, in prompt
    return self.app.run(set_exception_handler=set_exception_handler)
  File "/home/jake/.local/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 811, in run
    return loop.run_until_complete(
  File "/usr/lib64/python3.8/asyncio/base_events.py", line 592, in run_until_complete
    self._check_running()
  File "/usr/lib64/python3.8/asyncio/base_events.py", line 552, in _check_running
    raise RuntimeError('This event loop is already running')
RuntimeError: This event loop is already running

If you suspect this is an IPython 7.13.0 bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@python.org

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    %config Application.verbose_crash=True

sys:1: RuntimeWarning: coroutine 'Application.run_async' was never awaited

Improve REPL support

Currently the users have to heavily rely on indentation by using the context manager or using some hacky approach like that:

from playwright import sync_playwright

pw_context = sync_playwright()
p = pw_context.__enter__()

browser = p.chromium.launch()
page = browser.newPage()

def log_and_continue_request(route, request):
    print(request.url)
    route.continue_()

# Log and continue all network requests
page.route('**', lambda route, request: log_and_continue_request(route, request))

page.goto('http://todomvc.com')
browser.close()
pw_context.__exit__(None, None, None)

Probably we should add helper functions as aliases for the duner methods.

Reported via Reddit: https://www.reddit.com/r/Python/comments/i4z17w/playwright_a_python_library_to_automate_chromium/g0pb8qp?utm_source=share&utm_medium=web2x

Test coverage plan

  • browser
  • defaultbrowsercontext wip

  • cookies
  • emulation
  • dispatchevent
  • headful
  • dialog
  • focus
  • geolocation
  • accessibility
  • add_init_script
  • browsercontext
  • check
  • click
  • console
  • download
  • element_handle
  • evaluate
  • fill
  • frames
  • generation
  • ignore_https_errors
  • input
  • interception
  • jshandle
  • keyboard
  • launcher
  • navigation
  • network
  • page
  • pdf
  • popup
  • queryselector
  • worker

Runtime warning for mobile example in readme

Running the mobile and geo example from readme gives the following runtime warning. Python 3.8.3 on macOS 10.15

mobile.py:18: RuntimeWarning: coroutine 'Page.waitForEvent' was never awaited
  await page.waitForRequest('*preview/pwa')
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Dockerfile for playwright-python is too large

The Docker image for playwright-python turns out to be really large (above 2 GB). It is due to the fact that pip installing playwright will download the binary for 3 browsers. Any tip on how to create a dockerfile for each individual browser ?

FROM ubuntu:focal

RUN apt-get update
&& apt-get install -y wget gnupg
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
&& apt-get update
&& apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf
python3.8 python3.8-dev python3-pip
--no-install-recommends
&& rm -rf /var/lib/apt/lists/*

RUN apt-get update &&
apt-get -y install xvfb libdbus-glib-1-2 libegl1 libgl1 libgles2 libgudev-1.0 libopus0 libwebp6
libwebp6 libwoff1 libxslt1.1 libxslt1.1 gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2
libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0
libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1
libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1
libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget &&
rm -rf /var/lib/apt/lists/*

Install production dependencies.

RUN pip3 install playwright

BrowserType.connect(wsEndpoint) method is not working

If I've websocket endpoint of chrome page is it possible to connect to that page directly via playwright?

Eg:

I've websocket endpoint for page as ws://localhost:9222/devtools/page/DAB7FB6187B554E10B0BD18821265734
I would like to connect to that via playwright.

[Feature] Allow kwarg as selector name in selector usages

Request came from a coworker, since its not that nice to mix quotes we could allow something like that:

page.waitForSelector(text="This password is too common")

instead of

page.waitForSelector('text="This password is too common"')

Which internally would use the "unknown" kwarg (keyword argument) and concatenate the name of it with the value which will be used as the selector in the end.

Windows driver: "driver-win.exe install returned non-zero exit status 1."

Issue description:

Python version of playwright is installed inside a python venv. Running 'python -m playwright install' commands ends in 'driver-win.exe install returned non-zero exit status 1' error.

Versions used:

  1. Win 10
  2. Python 3.8.1
  3. playwright-python 0.7.1

Steps to recreate:

  1. Create python venv with command: 'python -m venv playwright_test'.
  2. Activate venv.
  3. Install playwright-python with command 'pip install playwright'.
  4. Issue command 'python -m playwright install'.
  5. Observe and error: 'subprocess.CalledProcessError: Command '\driver-win.exe install' returned non-zero exit status 1.

Problem description:

File 'driver-win.exe' is nowhere to be found and playwright installer does not download it. Searched the repo, can't see it there.

Implement missing APIs

  • Method not implemented: Download.createReadStream <- decided to skip for now
  • Method not implemented: Download.saveAs
  • Method not implemented: Request.postDataBuffer
  • Method not implemented: Request.postDataJSON

No module named 'playwright._repo_version'

ImportError while loading conftest '/home/pfeldman/code/playwright-python/tests/conftest.py'.
tests/conftest.py:19: in
import playwright
playwright/init.py:15: in
from playwright._repo_version import version as version # noqa:F401
E ModuleNotFoundError: No module named 'playwright._repo_version'

Fix skipped tests

  • @pytest.mark.skip("currently flaky") # TODO: should be removed
    async def test_browser_disconnect_should_reject_navigation_when_browser_closes(
    browser_type, launch_arguments, server
    ):
    server.set_route("/one-style.css", lambda r: None)
    browser_server = await browser_type.launchServer(**launch_arguments)
    remote = await browser_type.connect(wsEndpoint=browser_server.wsEndpoint)
    page = await remote.newPage()
    goto_future = asyncio.Future()
  • @pytest.mark.skip("todo mxschmitt")
    async def test_expose_function_should_throw_exception_in_page_context(page, server):
    def throw():
  • @pytest.mark.skip(
    "rpc server does not decode the base64 payload"
    ) # TODO: @pavelfeldman
  • @pytest.mark.skip("Seems to be broken currerntly") # TODO: mxschmitt after next roll
    async def test_bounding_box_return_null_for_invisible_elements(page, server):
    await page.setContent('<div style="display:none">hi</div>')
    element = await page.querySelector("div")
    assert await element.boundingBox() is None
  • @pytest.mark.skip("sometimes hanging") # TODO: needs to be investigated
    async def test_page_events_request_should_report_requests_and_responses_handled_by_service_worker(
    page: Page, server
    ):
    await page.goto(server.PREFIX + "/serviceworkers/fetchdummy/sw.html")
    await page.evaluate("() => window.activationPromise")
    [request, sw_response] = await asyncio.gather(

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.