Python version of the Playwright testing and automation library.

Related tags

Testing playwright
Overview

🎭 Playwright for Python PyPI version Join Slack

Docs | API

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 90.0.4396.0
WebKit 14.1
Firefox 85.0b10

Headless execution is supported for all browsers on all platforms.

Usage

pip install playwright==1.8.0a1
playwright install

This installs Playwright and browser binaries for Chromium, Firefox and WebKit. Playwright requires Python 3.7+.

Record and generate code

Playwright can record user interactions in a browser and generate code. See demo.

# Pass --help to see all options
playwright codegen

Playwright offers both sync (blocking) API and async API. They are identical in terms of capabilities and only differ in how one consumes the API.

Sync API

This is our default API for short snippets and tests. If you are not using asyncio in your application, it is the easiest to use Sync API notation.

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://whatsmyuseragent.org/')
        page.screenshot(path=f'example-{browser_type.name}.png')
        browser.close()

Async API

If you app is based on the modern asyncio loop and you are used to async/await constructs, Playwright exposes Async API for you. You should also use this API inside the Jupyter Notebook and other REPL frameworks that are already based on asyncio.

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.newPage()
            await page.goto('http://whatsmyuseragent.org/')
            await page.screenshot(path=f'example-{browser_type.name}.png')
            await browser.close()

asyncio.run(main())

With pytest

Use our pytest plugin for Playwright.

def test_playwright_is_visible_on_google(page):
    page.goto("https://www.google.com")
    page.type("input[name=q]", "Playwright GitHub")
    page.click("input[type=submit]")
    page.wait_for_selector("text=microsoft/Playwright")

Interactive mode (REPL)

Blocking REPL, as in CLI:

>>> from playwright.sync_api import sync_playwright
>>> playwright = sync_playwright().start()

# Use playwright.chromium, playwright.firefox or playwright.webkit
# Pass headless=False to see the browser UI
>>> browser = playwright.chromium.launch()
>>> page = browser.new_page()
>>> page.goto("http://whatsmyuseragent.org/")
>>> page.screenshot(path="example.png")
>>> browser.close()
>>> playwright.stop()

Async REPL such as Jupyter Notebook:

>>> from playwright.async_api import async_playwright
>>> playwright = await async_playwright().start()
>>> browser = await playwright.chromium.launch()
>>> page = await browser.new_page()
>>> await page.goto("http://whatsmyuseragent.org/")
>>> await page.screenshot(path="example.png")
>>> await browser.close()
>>> await playwright.stop()

Examples

Mobile and geolocation

This snippet emulates Mobile Safari on a device at a given geolocation, navigates to maps.google.com, performs action and takes a screenshot.

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    iphone_11 = p.devices["iPhone 11 Pro"]
    browser = p.webkit.launch(headless=False)
    context = browser.new_context(
        **iphone_11,
        locale="en-US",
        geolocation={"longitude": 12.492507, "latitude": 41.889938 },
        permissions=["geolocation"]
    )
    page = context.new_page()
    page.goto("https://maps.google.com")
    page.click("text=Your location")
    page.screenshot(path="colosseum-iphone.png")
    browser.close()
Async variant
import asyncio
from playwright.async_api import async_playwright

async def main():
    async with async_playwright() as p:
        iphone_11 = p.devices["iPhone 11 Pro"]
        browser = await p.webkit.launch(headless=False)
        context = await browser.newContext(
            **iphone_11,
            locale="en-US",
            geolocation={"longitude": 12.492507, "latitude": 41.889938},
            permissions=["geolocation"]
        )
        page = await context.newPage()
        await page.goto("https://maps.google.com")
        await page.click("text="Your location"")
        await page.screenshot(path="colosseum-iphone.png")
        await browser.close()

asyncio.run(main())

Evaluate JS in browser

This code snippet navigates to example.com in Firefox, and executes a script in the page context.

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.firefox.launch()
    page = browser.new_page()
    page.goto("https://www.example.com/")
    dimensions = page.evaluate("""() => {
      return {
        width: document.documentElement.clientWidth,
        height: document.documentElement.clientHeight,
        deviceScaleFactor: window.devicePixelRatio
      }
    }""")
    print(dimensions)
    browser.close()
Async variant
import asyncio
from playwright.async_api import async_playwright

async def main():
    async with async_playwright() as p:
        browser = await p.firefox.launch()
        page = await browser.new_page()
        await page.goto("https://www.example.com/")
        dimensions = await page.evaluate("""() => {
          return {
            width: document.documentElement.clientWidth,
            height: document.documentElement.clientHeight,
            deviceScaleFactor: window.devicePixelRatio
          }
        }""")
        print(dimensions)
        await browser.close()

asyncio.run(main())

Intercept network requests

This code snippet sets up request routing for a Chromium page to log all network requests.

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch()
    page = browser.new_page()

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

    # Log and continue all network requests
    page.route("**/*", log_and_continue_request)

    page.goto("http://todomvc.com")
    browser.close()
Async variant
import asyncio
from playwright.async_api import async_playwright

async def main():
    async with async_playwright() as p:
        browser = await p.chromium.launch()
        page = await browser.newPage()

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

        # Log and continue all network requests
        await page.route("**/*", log_and_continue_request)
        await page.goto("http://todomvc.com")
        await browser.close()

asyncio.run(main())

Documentation

Check out our new documentation site!

Is Playwright ready?

Yes, Playwright for Python is ready! The latest version of Playwright for Python is 1.8.0a. We are ready to drop the Alpha bit once we hear from you. Once it is gone, we will become semver compatible and the API will be frozen in its present form for years. We will still be adding features with every release, but we promise to not break it anymore!

Migration from the pre-release versions

The API has changed since the last 0.170.0 version:

  • Snake case notation for methods and arguments:

    # old
    browser.newPage()
    # new
    browser.new_page()
  • Import has changed to include sync vs async mode explicitly:

    # old
    from playwright import sync_playwright
    # new
    from playwright.sync_api import sync_playwright

That's about it! Our new doc site uses proper notation and examples for the new API.

Comments
  • "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 [email protected]
    
    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
    
    P3-collecting-feedback 
    opened by JacobCallahan 40
  • how to process 2 pages in diffrent threads?

    how to process 2 pages in diffrent threads?

    i want to open 2 pages and create 2 thread,thread 1 process page1,and thread 2 process page 2. i try this code

    def run1(context):
        page = context.new_page()
        page.goto('https://page1')
        page.wait_for_timeout(5000)
        page.close()
    
    def run2(context):
        page = context.new_page()
        page.goto('https://page2')
        page.wait_for_timeout(1000)
        page.close()
    
    def main():
        with sync_playwright() as playwright:
            browser = playwright.chromium.launch(headless=False)
            context = browser.new_context()
            t=Thread(target=run1,args=(context,))
            t1=Thread(target=run2,args=(context,))
            t.start()
            t1.start()
            t.join()
            t1.join()
            context.close()
            browser.close()
    

    but first open page 1 and 5 seconds later ,it opens page 2. it oepens the pages one by one how can i process multi page in diffrent thread at same time

    triaging 
    opened by czcz1024 28
  • [Bug]: AttributeError: 'PlaywrightContextManager' object has no attribute '_playwright'

    [Bug]: AttributeError: 'PlaywrightContextManager' object has no attribute '_playwright'

    Playwright version

    1.16.1

    Operating system

    Windows 10

    What browsers are you seeing the problem on?

    No response

    Other information

    python 3.10.0

    What happened? / Describe the bug

    I see AttributeError sometimes when I run playwright.

    Code snippet to reproduce your bug

    from playwright.sync_api import sync_playwright
    
    for i in range(10000):
        print(i)
        with sync_playwright() as p:
            pass
    

    Relevant log output

    Traceback (most recent call last):
      File "...\scratches\scratch_1.py", line 4, in <module>
        print(i)
      File "...\venv\lib\site-packages\playwright\sync_api\_context_manager.py", line 71, in __enter__
        playwright = self._playwright
    AttributeError: 'PlaywrightContextManager' object has no attribute '_playwright'
    
    triaging 
    opened by KotlinIsland 21
  • [Question]: 'c:\Users\ASUS' is not recognized as an internal or external command, operable program or batch file.

    [Question]: 'c:\Users\ASUS' is not recognized as an internal or external command, operable program or batch file.

    Your question

    Peace, hi 1- created a virualenv 2- installed successfully playwright by "pip install playwright" 3- try to install playwright driver by "playwright install"

    it gives me this output: '""c:\Users\ASUS' is not recognized as an internal or external command, operable program or batch file.

    python version 3.10.6

    opened by amuza2 18
  • Support the conda package manager for installation

    Support the conda package manager for installation

    It would be really useful if a conda recipe was added so that playwright was also available in the conda-forge community channel and usable with conda. Any plans to do this?

    opened by desilinguist 17
  • BrowserType.connect(wsEndpoint) method is not working

    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.

    P2-bug 
    opened by kesavkolla 15
  • [Question]: Taking screenshot of page immediately

    [Question]: Taking screenshot of page immediately

    Your question

    I've run into an issue where a call to page.screenshot(timeout=500) is timing out, raising the exception: TimeoutError('Timeout 500ms exceeded.\n=========================== logs ===========================\ntaking page screenshot\n============================================================'). I think at the time this occurs, the page is loading.

    How do I make it take the screenshot immediately? page.click() has force to skip actionability checks, page.screenshot() does not.

    Also, when the timeout occurs, is there a way to determine what it was waiting for (eg is it waiting for the page to load, or something else?)

    triaging 
    opened by Zeckie 14
  • Adding extension causes extra unwanted blank page to open and extension's opened page becomes a 'ghost' page and is completely unreachable!

    Adding extension causes extra unwanted blank page to open and extension's opened page becomes a 'ghost' page and is completely unreachable!

    On JavaScript adding an extension which opens 'welcome' page such as MetaMask => extension opens 1 new page and you can close this page and the default page.

    On Playwright Python adding an extension which opens 'welcome' page such as MetaMask => extension opens 1 extra blank page (2 blank pages / total) and a new 'extension' 'ghost' page which is unnaccessible from Playwright Python and you cannot close it.

    I briefly mentioned this issue on https://github.com/microsoft/playwright-python/issues/681 where the developer who got assigned fixed my main issue in the title but skimmed over this issue. The developer's given fix only fixed browser.close() raising errors => into => not raising errors, but not this issue. This issue is still 'at large' (i.e. especially of a criminal or dangerous animal) at liberty; escaped or not yet captured.)

    PROBLEM: this bug causes an unaccessible 'extension' page to just hang there and I cannot close it using code. It's not inside browser.pages.

    Illustrative image sets with descriptive captions:

    1. Playwright JS https://imgur.com/a/X13eydu

    2. Playwright Python https://imgur.com/a/mkINpWl

    EDIT: adding source as by confusing from @pavelfeldman 's reply

    import playwright
    from playwright.sync_api import sync_playwright
    
    EXT_1_DIR = "C:/Users/PC/Desktop/PW_PY/metamask_unpck"
    USER_DIR = "C:/Users/PC/AppData/Local/Google/Chrome/User Data/Profile 2"
    
    ARGS = [
        "--disable-extensions-except={}".format(EXT_1_DIR),
        "--load-extension={}".format(EXT_1_DIR)
    ]
    
    
    with sync_playwright() as p:
        browser = p.chromium.launch_persistent_context(USER_DIR, headless=False, args=ARGS)
        page = browser.new_page()
        _ = input("Wait till Metamask loads? ")
        print("len_pages()", len(browser.pages))
        for pg in browser.pages:
            pg.close()
    
        _ = input("Close browser? ")
        browser.close()
    

    EDIT: update to @pavelfeldman 's input.

    new source

    import playwright
    from playwright.sync_api import sync_playwright
    
    EXT_1_DIR = "C:/Users/PC/Desktop/PW_PY/metamask_unpck"
    USER_DIR = "C:/Users/PC/AppData/Local/Google/Chrome/User Data/Profile 2"
    
    ARGS = [
        "--disable-extensions-except={}".format(EXT_1_DIR),
        "--load-extension={}".format(EXT_1_DIR)
    ]
    
    
    with sync_playwright() as p:
    	# 1) launch MetaMask
        browser = p.chromium.launch_persistent_context(USER_DIR, headless=False, args=ARGS)
        _ = input("Wait till Metamask loads? ")
       
       	# 2) print len() pages and bg_pagesshould be 2, but is 1 (bug)
        print("len_pages()", len(browser.pages))
        print("len_background_pages()", len(browser.background_pages))
    
        _ = input("Close pages? ")
        # 2.1) pages don't get closed, only blank page is detected and closed, 2nd page does not get detected,
        # or, closed
        for pg in browser.pages:
            pg.close()
    
    
        # 3) close the browser, old bug error on closing was fixed by your dev - all good- thanks him
        _ = input("Close browser? ")
        browser.close()
    

    As we see, the page doesn't fall into browser.background_pages it's just not there. Also, note, for Playwright JS it falls into normal pages.

    Illustrative screenshot: https://imgur.com/a/Yh1BIQr

    triaging 
    opened by ivarsj10s 14
  • playwright._impl._api_types.Error: Host system is missing dependencies!

    playwright._impl._api_types.Error: Host system is missing dependencies!

    environment

    CentOS Linux release 7.9.2009 (Core) Python 3.7.3 playwright==1.8.0a1

    playwright._impl._api_types.Error: Host system is missing dependencies!
    
      Missing libraries are:
          libatk-1.0.so.0
          libatk-bridge-2.0.so.0
          libxkbcommon.so.0
          libXcomposite.so.1
          libXdamage.so.1
          libXfixes.so.3
          libXrandr.so.2
          libgbm.so.1
          libgtk-3.so.0
          libgdk-3.so.0
          libpango-1.0.so.0
          libcairo.so.2
          libatspi.so.0
          libxshmfence.so.1
    
    Note: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.
    
    During handling of the above exception, another exception occurred:
    
    
    yum -y install libatk-1.0.so.0 libatk-bridge-2.0.so.0 libxkbcommon.so.0 libXcomposite.so.1 libXdamage.so.1 libXfixes.so.3 libXrandr.so.2 libgbm.so.1 libgtk-3.so.0 libgdk-3.so.0 libpango-1.0.so.0 libcairo.so.2 libatspi.so.0 libxshmfence.so.1
    

    This problem is still displayed after installing dependencies

    opened by dmf-code 14
  • [Question]: Getting error `FileNotFoundError: [Errno 2] No such file or directory: '/Users/my_user/.pyenv/versions/pwright_new/lib/python3.9/site-packages/playwright/driver/playwright-cli'`

    [Question]: Getting error `FileNotFoundError: [Errno 2] No such file or directory: '/Users/my_user/.pyenv/versions/pwright_new/lib/python3.9/site-packages/playwright/driver/playwright-cli'`

    Your question

    I just installed playwright and tried running the example script as per the readme but I am getting an error:

    my script:

    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://whatsmyuseragent.org/')
                await page.screenshot(path=f'example-{browser_type.name}.png')
                await browser.close()
    
    asyncio.run(main())
    
    >>> Traceback (most recent call last):
      File "/Users/my_user/Documents/pwright/test1.py", line 18, in <module>
        asyncio.run(main())
      File "/Users/my_user/.pyenv/versions/3.9.1/lib/python3.9/asyncio/runners.py", line 44, in run
        return loop.run_until_complete(main)
      File "/Users/my_user/.pyenv/versions/3.9.1/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
        return future.result()
      File "/Users/my_user/Documents/pwright/test1.py", line 9, in main
        async with async_playwright() as p:
      File "/Users/my_user/.pyenv/versions/pwright_new/lib/python3.9/site-packages/playwright/main.py", line 110, in __aenter__
        self._connection = await run_driver_async()
      File "/Users/my_user/.pyenv/versions/pwright_new/lib/python3.9/site-packages/playwright/main.py", line 56, in run_driver_async
        proc = await asyncio.create_subprocess_exec(
      File "/Users/my_user/.pyenv/versions/3.9.1/lib/python3.9/asyncio/subprocess.py", line 236, in create_subprocess_exec
        transport, protocol = await loop.subprocess_exec(
      File "/Users/my_user/.pyenv/versions/3.9.1/lib/python3.9/asyncio/base_events.py", line 1661, in subprocess_exec
        transport = await self._make_subprocess_transport(
      File "/Users/my_user/.pyenv/versions/3.9.1/lib/python3.9/asyncio/unix_events.py", line 197, in _make_subprocess_transport
        transp = _UnixSubprocessTransport(self, protocol, args, shell,
      File "/Users/my_user/.pyenv/versions/3.9.1/lib/python3.9/asyncio/base_subprocess.py", line 36, in __init__
        self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
      File "/Users/my_user/.pyenv/versions/3.9.1/lib/python3.9/asyncio/unix_events.py", line 789, in _start
        self._proc = subprocess.Popen(
      File "/Users/my_user/.pyenv/versions/3.9.1/lib/python3.9/subprocess.py", line 947, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "/Users/my_usery/.pyenv/versions/3.9.1/lib/python3.9/subprocess.py", line 1819, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: '/Users/my_user/.pyenv/versions/pwright_new/lib/python3.9/site-packages/playwright/driver/playwright-cli'
    
    - My Python version 3.9.1
    - Pyenv virtualenv for creating virtual environment
    - macOS big sur [intel mac]
    triaging 
    opened by nileshpandey3 13
  • [Bug]: Not able to install Playwright in Docker on M1 with aarch64 architecture

    [Bug]: Not able to install Playwright in Docker on M1 with aarch64 architecture

    Playwright version

    1.12.1

    Operating system

    MacOS

    What browsers are you seeing the problem on?

    Chromium

    Other information

    No response

    What happened? / Describe the bug

    Hi

    I'm using playwright docker image here => https://hub.docker.com/_/microsoft-playwright

    I encounter an issue where if I run playwright in the docker, I would have the below error

    (node:97) UnhandledPromiseRejectionWarning: Error: Page closed at CRSession. (/usr/local/lib/python3.8/dist-packages/playwright/driver/package/lib/server/chromium/crPage.js:341:60) at Object.onceWrapper (events.js:420:28) at CRSession.emit (events.js:326:22) at /usr/local/lib/python3.8/dist-packages/playwright/driver/package/lib/server/chromium/crConnection.js:177:43 (node:97) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

    It run fine in my own machine (macOS m1). I research and saw that it is related to browser.close too early. However, I'm using pytest and is using playwright as sync and not async function since pytest has fixture which can yield the page and then do a browser close later. E.g code below:

    @pytest.fixture def page(): with sync_playwright() as p: browser = p.chromium.launch() page = browser.new_page() yield page browser.close()

    Do we. know why the same code run fine in my local machine but not in playwright docker?

    Code snippet to reproduce your bug

    No response

    Relevant log output

    No response

    P3-collecting-feedback 
    opened by budsee 13
  • self-signed cert error when downloading browser form artifact repository

    self-signed cert error when downloading browser form artifact repository

    Context:

    • Operating System: Linux
    • Python version: 3.x
    • Browser: Chromium
    • Extra: pulling from Artifact repo

    Describe the bug

    I am trying to install chromium inside my python virtual env from an artifact repository but am receiving "Error: self signed certificate in certificate chain" Running python3 reqests.get(https://my.artifact.repo) initially returned the same SSL error which made sense because my OS certs were not in my pyvenv, however I added our certs to the pyvenv/lib64/python3.x/site-packages/certifi/mycacerts.pem and re-running the get request using requests returned: <Response [200]> so I believe the certs are working as expected (artifact repo via browser works as expected too).

    However, when I run the following:

    PLAYWRIGHT_DOWNLOAD_HOST=HTTPS://my.artifact.repository/././chromiumplaywright install
    

    I still receive:

    "Error: self signed certificate in certificate chain"
    Error: Download failure, code=1, at ChildProcess.<anonymous> (/pyvenv/lib/python3.x/site-packages/playwright/driver/package/lib/server/registry/BrowserFetcher.js
    

    I'm a bit ignorant to how the Python version of Playwright is running a Javascript file but I did follow the Playwright documentation for "Browsers>Download from an artifact repository" and even tried adding in the:

    NODE_EXTRA_CA_CERTS=pyvenv/lib64/python3.x/site-packages/certifi/mycacerts.pem
    

    environment variable to specify my cert path but received the same self-signed cert error.

    I did go on a Node.js tangent and some of the documentation seems to imply that NODE_EXTRA_CA_CERTS can only be set when the initial Node.js process is first launches: https://nodejs.org/api/cli.html#node_extra_ca_certsfile.
    This does make me wonder if I need to set the NODE_EXTRA_CA_CERTS as a variable in one of the .js files Playwright uses, but again I am a little ensure how these work. Thank you.

    triaging 
    opened by brendonts 3
  • Issue building with python-build/installer

    Issue building with python-build/installer

    For packaging playwright for Arch Linux I tried to build and install it using:

    python -m build --wheel --no-isolation
    python -m installer --destdir="$pkgdir" dist/*.whl
    

    this fails currently with:

    ==> Starting package()...
    Traceback (most recent call last):
      File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
        return _run_code(code, main_globals, None,
      File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
        exec(code, run_globals)
      File "/usr/lib/python3.10/site-packages/installer/__main__.py", line 98, in <module>
        _main(sys.argv[1:], "python -m installer")
      File "/usr/lib/python3.10/site-packages/installer/__main__.py", line 94, in _main
        installer.install(source, destination, {})
      File "/usr/lib/python3.10/site-packages/installer/_core.py", line 96, in install
        for record_elements, stream, is_executable in source.get_contents():
      File "/usr/lib/python3.10/site-packages/installer/sources.py", line 158, in get_contents
        assert record is not None, "In {}, {} is not mentioned in RECORD".format(
    AssertionError: In dist/playwright-1.29.0-py3-none-manylinux1_x86_64.whl, playwright/driver/node is not mentioned in RECORD
    ==> ERROR: A failure occurred in package().
        Aborting...
    

    The generated wheel seems to be wrong:

    [jelle@natrium][~/Downloads/python-playwright/src/playwright-python-1.29.0/dist]%cat --style=plain playwright-1.29.0.dist-info/RECORD
    playwright/__init__.py,sha256=BsOs2t0T4oE_y5WtkdU-44hcK19HO-zMRaV52c7q1ws,805
    playwright/__main__.py,sha256=Ni-VibWcnhVpntP9VLeUHWUB2AGFh1QRyqP3TYTs4qI,964
    playwright/_repo_version.py,sha256=_rctfPDph1ATziwQ_Kw-ESD20nyypxJbuBbphV5sTK8,19
    playwright-1.29.0.dist-info/LICENSE,sha256=f6sUYbQZcP83bxyTA6Y3B2v6rrcc0S3TocRKr1mhork,11399
    playwright-1.29.0.dist-info/METADATA,sha256=Pgv7IMtkLP_NeMgW-XVMzKmuw--5UlClKCBnJOgKqeY,3565
    playwright-1.29.0.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
    playwright-1.29.0.dist-info/entry_points.txt,sha256=G-lS5tnQw21PHcXKbZFGy81lczindXIDUejIefH8VoY,130
    playwright-1.29.0.dist-info/top_level.txt,sha256=oYiz5-Zb4y23ANZot2i3lMsK-BAiwXqTlQ4hytLJYuE,11
    playwright-1.29.0.dist-info/RECORD,,
    

    Versus:

    playwright-1.28.0.dist-info/LICENSE,sha256=f6sUYbQZcP83bxyTA6Y3B2v6rrcc0S3TocRKr1mhork,11399
    playwright-1.28.0.dist-info/top_level.txt,sha256=oYiz5-Zb4y23ANZot2i3lMsK-BAiwXqTlQ4hytLJYuE,11
    playwright-1.28.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
    playwright-1.28.0.dist-info/entry_points.txt,sha256=G-lS5tnQw21PHcXKbZFGy81lczindXIDUejIefH8VoY,130
    playwright-1.28.0.dist-info/RECORD,,
    playwright-1.28.0.dist-info/METADATA,sha256=c6Rm8AR52ue-ODdcg_uzALl5aRwOsVb365cU_ElV8Lo,3565
    playwright/_repo_version.py,sha256=awUd0rfOi79VMjM8HkYDAE0wB4W10wqUL1kdZAy76qM,19
    playwright/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
    playwright/__main__.py,sha256=Ni-VibWcnhVpntP9VLeUHWUB2AGFh1QRyqP3TYTs4qI,964
    playwright/__init__.py,sha256=BsOs2t0T4oE_y5WtkdU-44hcK19HO-zMRaV52c7q1ws,805
    ......
    

    Seems setup.py works but does not install the driver folder.

    triaging 
    opened by jelly 1
  • PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=1 warns to stdout and breaks transport protocol

    PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=1 warns to stdout and breaks transport protocol

    Context:

    • Playwright Version: 1.29.0

    Describe the bug

    playwright writes to stdout when PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=1 is set https://github.com/microsoft/playwright/blob/7508c574e12e31c774668b717f3c2449a82565b1/packages/playwright-core/src/server/registry/index.ts#L657 and that breaks transport protocol that expects 4 bytes length + json on stdout https://github.com/microsoft/playwright-python/blob/eb4b88af72aa6757c95f5a74f11ad6503bf16038/playwright/_impl/_transport.py#L140-L160

    v1.30 
    opened by kalekseev 1
  • [BUG] Now work mocking with route.fulfill json

    [BUG] Now work mocking with route.fulfill json

    Context:

    • Playwright Version: [Version 1.29]
    • Operating System: [Windows, Mac]
    • Python version: [3.10]
    • Browser: [Chromium,]

    Code Snippet

    def test_mock_tags(page):
    
        def handle_route(route: Route):
    
            response = route.fetch()
            json = response.json()
            json["tags"] = ["implementations", "deserunt"]
            route.fulfill(json=json, response=response)
    
    
        page.route("**/api/tags", handle_route)
        page.goto('https://demo.realworld.io/')
    

    Describe the bug There is no mocking of json data.

    v1.29 
    opened by zimaev 3
  • [Ports]: Backport client side changes

    [Ports]: Backport client side changes

    Please backport client side changes:

    • [ ] https://github.com/microsoft/playwright/commit/412c11db208da0543137ac781e775578a72eaece (fix(reuse): make sure all dispose and close sequences are executed (#19572))
    • [ ] https://github.com/microsoft/playwright/commit/d7e7cab44a28cf46e99fd9a0902a054e9088183e (fix: properly handle negated timed-out toPass matcher (#19580))
    • [x] https://github.com/microsoft/playwright/commit/95cc5c2a2e74bfa3437dea26395c661238876974 (fix(electron): fix the directory app path (#19601))
    • [x] https://github.com/microsoft/playwright/commit/fe989d95eb709ff436d4cace44d66acc6950abde (chore(electron): move loader to be preload (#19650))
    v1.30 
    opened by playwrightmachine 0
Releases(v1.29.0)
  • v1.29.0(Dec 21, 2022)

    Highlights

    New APIs

    • New method Route.fetch and new option json for Route.fulfill:

      def handle_route(route: Route):
        # Fetch original settings.
        response = route.fetch()
        # Force settings theme to a predefined value.
        json = response.json()
        json["theme"] = "Solorized"
        # Fulfill with modified data.
        route.fulfill(json=json)
      page.route("**/api/settings", handle_route)
      
    • New method Locator.all to iterate over all matching elements:

      # Check all checkboxes!
      checkboxes = page.get_by_role("checkbox")
      for checkbox in checkboxes.all():
        checkbox.check()
      
    • Locator.select_option matches now by value or label:

      <select multiple>
        <option value="red">Red</div>
        <option value="green">Green</div>
        <option value="blue">Blue</div>
      </select>
      
      element.select_option("Red")
      

    Miscellaneous

    Browser Versions

    • Chromium 109.0.5414.46
    • Mozilla Firefox 107.0
    • WebKit 16.4

    This version was also tested against the following stable channels:

    • Google Chrome 108
    • Microsoft Edge 108
    Source code(tar.gz)
    Source code(zip)
  • v1.28.0(Nov 16, 2022)

    Highlights

    Playwright Tools

    • Live Locators in CodeGen. Generate a locator for any element on the page using "Explore" tool.

    Locator Explorer

    New APIs

    Browser Versions

    • Chromium 108.0.5359.29
    • Mozilla Firefox 106.0
    • WebKit 16.4

    This version was also tested against the following stable channels:

    • Google Chrome 107
    • Microsoft Edge 107
    Source code(tar.gz)
    Source code(zip)
  • v1.27.1(Oct 12, 2022)

    Highlights

    This patch release includes the following bug fixes:

    https://github.com/microsoft/playwright/pull/18010 - fix(generator): generate nice locators for arbitrary selectors https://github.com/microsoft/playwright/pull/17952 - fix: fix typo in treeitem role typing

    Browser Versions

    • Chromium 107.0.5304.18
    • Mozilla Firefox 105.0.1
    • WebKit 16.0

    This version was also tested against the following stable channels:

    • Google Chrome 106
    • Microsoft Edge 106
    Source code(tar.gz)
    Source code(zip)
  • v1.27.0(Oct 7, 2022)

    Locators

    With these new APIs, inspired by Testing Library, writing locators is a joy:

    page.get_by_label("User Name").fill("John")
    
    page.get_by_label("Password").fill("secret-password")
    
    page.get_by_role("button", name="Sign in").click()
    
    expect(page.get_by_text("Welcome, John!")).to_be_visible()
    

    All the same methods are also available on Locator, FrameLocator and Frame classes.

    Other highlights

    • As announced in v1.25, Ubuntu 18 will not be supported as of Dec 2022. In addition to that, there will be no WebKit updates on Ubuntu 18 starting from the next Playwright release.

    Behavior Changes

    • expect(locator).to_have_attribute(name, value) with an empty value does not match missing attribute anymore. For example, the following snippet will succeed when button does not have a disabled attribute.

      expect(page.get_by_role("button")).to_have_attribute("disabled", "")
      

    Browser Versions

    • Chromium 107.0.5304.18
    • Mozilla Firefox 105.0.1
    • WebKit 16.0

    This version was also tested against the following stable channels:

    • Google Chrome 106
    • Microsoft Edge 106
    Source code(tar.gz)
    Source code(zip)
  • v1.26.1(Sep 28, 2022)

    Bugfixes

    • fix(driver): with CWD which contained spaces (https://github.com/microsoft/playwright/pull/17579, #1561, #1565)
    • chore: mark pathAfterFinished return value optional (#1567)
    Source code(tar.gz)
    Source code(zip)
  • v1.26.0(Sep 20, 2022)

    Highlights

    Assertions

    Other highlights

    Behavior Change

    A bunch of Playwright APIs already support the wait_until: "domcontentloaded" option. For example:

    page.goto("https://playwright.dev", wait_until="domcontentloaded")
    

    Prior to 1.26, this would wait for all iframes to fire the DOMContentLoaded event.

    To align with web specification, the 'domcontentloaded' value only waits for the target frame to fire the 'DOMContentLoaded' event. Use wait_until="load" to wait for all iframes.

    Browser Versions

    • Chromium 106.0.5249.30
    • Mozilla Firefox 104.0
    • WebKit 16.0

    This version was also tested against the following stable channels:

    • Google Chrome 105
    • Microsoft Edge 105
    Source code(tar.gz)
    Source code(zip)
  • v1.25.2(Aug 23, 2022)

    Highlights

    • [BUG] Jammy images not available in advertised location (https://github.com/microsoft/playwright-python/issues/1518)
    • Roll to latest patch release of upstream driver
    Source code(tar.gz)
    Source code(zip)
  • v1.25.1(Aug 16, 2022)

    Bugfixes

    • [REGRESSION] 1.25.0 distributes "scripts" as a package (https://github.com/microsoft/playwright-python/issues/1500#issuecomment-1216847242)
    Source code(tar.gz)
    Source code(zip)
  • v1.25.0(Aug 15, 2022)

    Highlights

    Announcements

    • 🎁 We now ship Ubuntu 22.04 Jammy Jellyfish docker image: mcr.microsoft.com/playwright/python:v1.25.0-jammy.
    • 🪦 This is the last release with macOS 10.15 support (deprecated as of 1.21).
    • ⚠️ Ubuntu 18 is now deprecated and will not be supported as of Dec 2022.

    Browser Versions

    • Chromium 105.0.5195.19
    • Mozilla Firefox 103.0
    • WebKit 16.0

    This version was also tested against the following stable channels:

    • Google Chrome 104
    • Microsoft Edge 104
    Source code(tar.gz)
    Source code(zip)
  • v1.24.1(Aug 1, 2022)

  • v1.24.0(Jul 22, 2022)

    Highlights

    🐂 Debian 11 Bullseye Support

    Playwright now supports Debian 11 Bullseye on x86_64 for Chromium, Firefox and WebKit. Let us know if you encounter any issues!

    Linux support looks like this:

    | | Ubuntu 18.04 | Ubuntu 20.04 | Ubuntu 22.04 | Debian 11 | :--- | :---: | :---: | :---: | :---: | | Chromium | ✅ | ✅ | ✅ | ✅ | | WebKit | ✅ | ✅ | ✅ | ✅ | | Firefox | ✅ | ✅ | ✅ | ✅ |

    📖 New Introduction Docs

    We rewrote our Getting Started docs to be more end-to-end testing focused. Check them out on playwright.dev.

    Browser Versions

    • Chromium 104.0.5112.48
    • Mozilla Firefox 102.0
    • WebKit 16.0

    This version was also tested against the following stable channels:

    • Google Chrome 103
    • Microsoft Edge 103
    Source code(tar.gz)
    Source code(zip)
  • v1.23.1(Jul 14, 2022)

    Bug Fixes

    • [BUG] Frame is emitted on Page events domcontentloaded/load #1399
    • [Question]: Task was destroyed but it is pending! in route.abort() #1402
    Source code(tar.gz)
    Source code(zip)
  • v1.23.0(Jun 30, 2022)

    Highlights

    Network Replay

    Now you can record network traffic into a HAR file and re-use this traffic in your tests.

    To record network into HAR file:

    npx playwright open --save-har=github.har.zip https://github.com/microsoft
    

    Alternatively, you can record HAR programmatically:

    context = browser.new_context(record_har_path="github.har.zip")
    # ... do stuff ...
    context.close()
    

    Use the new methods method: Page.route_from_har or method: BrowserContext.route_from_har to serve matching responses from the HAR file:

    context.route_from_har("github.har.zip")
    

    Read more in our documentation.

    Advanced Routing

    You can now use method: Route.fallback to defer routing to other handlers.

    Consider the following example:

    # Remove a header from all requests
    def remove_header_handler(route: Route) -> None:
        headers = route.request.all_headers()
        if "if-none-match" in headers:
            del headers["if-none-match"]
        route.fallback(headers=headers)
    
    page.route("**/*", remove_header_handler)
    
    # Abort all images
    def abort_images_handler(route: Route) -> None:
        if route.request.resource_type == "image":
            route.abort()
        else:
            route.fallback()
    
    page.route("**/*", abort_images_handler)
    

    Note that the new methods method: Page.route_from_har or method: BrowserContext.route_from_har also participate in routing and could be deferred to.

    Web-First Assertions Update

    Miscellaneous

    • If there's a service worker that's in your way, you can now easily disable it with a new context option service_workers:

      context = browser.new_context(service_workers="block")
      page = context.new_page()
      
    • Using .zip path for recordHar context option automatically zips the resulting HAR:

      context = browser.new_context(record_har_path="github.har.zip")
      
    • If you intend to edit HAR by hand, consider using the "minimal" HAR recording mode that only records information that is essential for replaying:

      context = browser.new_context(record_har_mode="minimal", record_har_path="har.har")
      
    • Playwright now runs on Ubuntu 22 amd64 and Ubuntu 22 arm64.

    Source code(tar.gz)
    Source code(zip)
  • v1.22.0(May 13, 2022)

    Highlights

    • Role selectors that allow selecting elements by their ARIA role, ARIA attributes and accessible name.

      # Click a button with accessible name "log in"
      page.click("role=button[name='log in']")
      

      Read more in our documentation.

    • New [method: Locator.filter] API to filter an existing locator

      buttons = page.locator("role=button")
      # ...
      submit_button = buttons.filter(has_text="Submit")
      submit_button.click()
      
    • Codegen now supports generating Pytest Tests

      Graphics

    Browser Versions

    • Chromium 102.0.5005.40
    • Mozilla Firefox 99.0.1
    • WebKit 15.4

    This version was also tested against the following stable channels:

    • Google Chrome 101
    • Microsoft Edge 101
    Source code(tar.gz)
    Source code(zip)
  • v1.21.0(Apr 13, 2022)

    Highlights

    • New experimental role selectors that allow selecting elements by their ARIA role, ARIA attributes and accessible name.

      # Click a button with accessible name "log in"
      page.click("role=button[name='log in']")
      

      To use role selectors, make sure to pass PLAYWRIGHT_EXPERIMENTAL_FEATURES=1 environment variable.

      Read more in our documentation.

    • New scale option in Page.screenshot for smaller sized screenshots.

    • New caret option in Page.screenshot to control text caret. Defaults to "hide".

    Behavior Changes

    • The mcr.microsoft.com/playwright docker image no longer contains Python. Please use mcr.microsoft.com/playwright/python as a Playwright-ready docker image with pre-installed Python.
    • Playwright now supports large file uploads (100s of MBs) via Locator.set_input_files API.

    Browser Versions

    • Chromium 101.0.4951.26
    • Mozilla Firefox 98.0.2
    • WebKit 15.4

    This version was also tested against the following stable channels:

    • Google Chrome 100
    • Microsoft Edge 100
    Source code(tar.gz)
    Source code(zip)
  • v1.20.1(Mar 23, 2022)

    Highlights

    This patch includes the following bug fixes:

    https://github.com/microsoft/playwright/issues/12711 - [REGRESSION] Page.screenshot hangs on some sites https://github.com/microsoft/playwright/issues/12807 - [BUG] Cookies get assigned before fulfilling a response https://github.com/microsoft/playwright/issues/12821 - [BUG] Chromium: Cannot click, element intercepts pointer events https://github.com/microsoft/playwright/issues/12887 - [BUG] Locator.count() with _vue selector with Repro https://github.com/microsoft/playwright/issues/12974 - [BUG] Regression - chromium browser closes during test or debugging session on macos

    Browser Versions

    • Chromium 101.0.4921.0
    • Mozilla Firefox 97.0.1
    • WebKit 15.4

    This version was also tested against the following stable channels:

    • Google Chrome 99
    • Microsoft Edge 99
    Source code(tar.gz)
    Source code(zip)
  • v1.20.0(Mar 15, 2022)

    Highlights

    Announcements

    • We now ship a designated Python docker image mcr.microsoft.com/playwright/python. Please switch over to it if you use Python. This is the last release that includes Python inside our javascript mcr.microsoft.com/playwright docker image.
    • v1.20 is the last release to receive WebKit update for macOS 10.15 Catalina. Please update MacOS to keep using latest & greatest WebKit!

    Browser Versions

    • Chromium 101.0.4921.0
    • Mozilla Firefox 97.0.1
    • WebKit 15.4

    This version was also tested against the following stable channels:

    • Google Chrome 99
    • Microsoft Edge 99
    Source code(tar.gz)
    Source code(zip)
  • v1.19.1(Feb 25, 2022)

    Highlights

    This patch includes the following bug fixes:

    https://github.com/microsoft/playwright-python/pull/1167 - [BUG] Task exception was never retrieved when continue_ race with page closed event https://github.com/microsoft/playwright/issues/12106 - [BUG] Error: EBUSY: resource busy or locked when using volumes in docker-compose with playwright 1.19.0 and mcr.microsoft.com/playwright:v1.15.0-focal https://github.com/microsoft/playwright/issues/12075 - [Question] After update to 1.19 firefox fails to run

    Browser Versions

    • Chromium 100.0.4863.0
    • Mozilla Firefox 96.0.1
    • WebKit 15.4

    This version was also tested against the following stable channels:

    • Google Chrome 98
    • Microsoft Edge 98
    Source code(tar.gz)
    Source code(zip)
  • v1.19.0(Feb 15, 2022)

    Version 1.19

    Locator Updates

    Locator now supports a has option that makes sure it contains another locator inside:

    page.locator("article", has=page.locator(".highlight")).click()
    

    The snippet above will select article that has highlight in it and will press the button in it. Read more in locator documentation

    Other Updates

    Browser Versions

    • Chromium 100.0.4863.0
    • Mozilla Firefox 96.0.1
    • WebKit 15.4

    This version was also tested against the following stable channels:

    • Google Chrome 98
    • Microsoft Edge 98
    Source code(tar.gz)
    Source code(zip)
  • v1.18.2(Feb 1, 2022)

    Highlights

    This patch includes bug fixes for the following issues:

    https://github.com/microsoft/playwright-python/pull/1117 - [BUG] Fixing a pyee DeprecationWarning

    Browser Versions

    • Chromium 99.0.4812.0
    • Mozilla Firefox 95.0
    • WebKit 15.4

    This version was also tested against the following stable channels:

    • Google Chrome 97
    • Microsoft Edge 97
    Source code(tar.gz)
    Source code(zip)
  • v1.18.1(Jan 20, 2022)

    Highlights

    This patch includes bug fixes for the following issues:

    https://github.com/microsoft/playwright/issues/11447 - [BUG] window.orientation on WebKit is different to what Safari gives you

    Browser Versions

    • Chromium 99.0.4812.0
    • Mozilla Firefox 95.0
    • WebKit 15.4

    This version was also tested against the following stable channels:

    • Google Chrome 97
    • Microsoft Edge 97
    Source code(tar.gz)
    Source code(zip)
  • v1.18.0(Jan 19, 2022)

    API Testing

    Playwright for Python 1.18 introduces new API Testing that lets you send requests to the server directly from Python! Now you can:

    • test your server API
    • prepare server side state before visiting the web application in a test
    • validate server side post-conditions after running some actions in the browser

    To do a request on behalf of Playwright's Page, use new page.request API:

    # Do a GET request on behalf of page
    res = page.request.get("http://example.com/foo.json")
    

    Read more in our documentation.

    Web-First Assertions

    Playwright for Python 1.18 introduces Web-First Assertions.

    Consider the following example:

    from playwright.sync_api import Page, expect
    
    def test_status_becomes_submitted(page: Page) -> None:
        # ..
        page.click("#submit-button")
        expect(page.locator(".status")).to_have_text("Submitted")
    

    Playwright will be re-testing the node with the selector .status until fetched Node has the "Submitted" text. It will be re-fetching the node and checking it over and over, until the condition is met or until the timeout is reached. You can pass this timeout as an option.

    Read more in our documentation.

    Locator Improvements

    New APIs & changes

    Browser Versions

    • Chromium 99.0.4812.0
    • Mozilla Firefox 95.0
    • WebKit 15.4

    This version was also tested against the following stable channels:

    • Google Chrome 97
    • Microsoft Edge 97
    Source code(tar.gz)
    Source code(zip)
  • v1.17.2(Dec 2, 2021)

    Highlights

    This patch includes bug fixes for the following issues:

    https://github.com/microsoft/playwright/issues/10638 - [BUG] Locator.click -> subtree intercepts pointer events since version 1.17.0 https://github.com/microsoft/playwright/issues/10632 - [BUG] Playwright 1.17.0 -> After clicking the element - I get an error that click action was failed https://github.com/microsoft/playwright/issues/10627 - [REGRESSION]: Can no longer click Material UI select box https://github.com/microsoft/playwright/issues/10620 - [BUG] trailing zero width whitespace fails toHaveText

    Browser Versions

    • Chromium 98.0.4695.0
    • Mozilla Firefox 94.0.1
    • WebKit 15.4

    This version of Playwright was also tested against the following stable channels:

    • Google Chrome 96
    • Microsoft Edge 96
    Source code(tar.gz)
    Source code(zip)
  • v1.17.1(Nov 30, 2021)

    Highlights

    This patch includes bug fixes for the following issues:

    https://github.com/microsoft/playwright/issues/10127 - [BUG] Add Trace Viewer error handling (file not found, not parsable) https://github.com/microsoft/playwright/issues/10436 - [Bug]: Add hints on how to open trace from HTML report when opened locally https://github.com/microsoft/playwright/pull/10492 - [Bug]: Fix broken Firefox User-Agent on 'Desktop Firefox' devices

    Browser Versions

    • Chromium 98.0.4695.0
    • Mozilla Firefox 94.0.1
    • WebKit 15.4

    This version was also tested against the following stable channels:

    • Google Chrome 96
    • Microsoft Edge 96
    Source code(tar.gz)
    Source code(zip)
  • v1.17.0(Nov 20, 2021)

    Playwright v1.17.0

    Frame Locators

    Playwright 1.17 introduces frame locators - a locator to the iframe on the page. Frame locators capture the logic sufficient to retrieve the iframe and then locate elements in that iframe. Frame locators are strict by default, will wait for iframe to appear and can be used in Web-First assertions.

    Graphics

    Frame locators can be created with either page.frame_locator(selector) or locator.frame_locator(selector) method.

    locator = page.frame_locator("my-frame").locator("text=Submit")
    locator.click()
    

    Read more at our documentation.

    Trace Viewer Update

    Playwright Trace Viewer is now available online at https://trace.playwright.dev! Just drag-and-drop your trace.zip file to inspect its contents.

    NOTE: trace files are not uploaded anywhere; trace.playwright.dev is a progressive web application that processes traces locally.

    • Playwright Test traces now include sources by default (these could be turned off with tracing option)
    • Trace Viewer now shows test name
    • New trace metadata tab with browser details
    • Snapshots now have URL bar

    image

    Ubuntu ARM64 support + more

    • Playwright now supports Ubuntu 20.04 ARM64. You can now run Playwright tests inside Docker on Apple M1 and on Raspberry Pi.

    New APIs

    • Tracing now supports a 'title' option
    • Page navigations support a new 'commit' waiting option

    Browser Versions

    • Chromium 98.0.4695.0
    • Mozilla Firefox 94.0.1
    • WebKit 15.4

    This version was also tested against the following stable channels:

    • Google Chrome 96
    • Microsoft Edge 96

    Source code(tar.gz)
    Source code(zip)
  • v1.16.1(Oct 29, 2021)

    Highlights

    This patch includes bug fixes for the following issues:

    https://github.com/microsoft/playwright/issues/9692 - [BUG] HTML report shows locator._withElement for locator.evaluate https://github.com/microsoft/playwright/issues/7818 - [Bug]: dedup snapshot CSS images

    Browser Versions

    • Chromium 97.0.4666.0
    • Mozilla Firefox 93.0
    • WebKit 15.4

    This version was also tested against the following stable channels:

    • Google Chrome 94
    • Microsoft Edge 94

    (1.16.2-1635322350000)

    Source code(tar.gz)
    Source code(zip)
  • v1.16.0(Oct 21, 2021)

    🎭 Playwright Library

    Locator.waitFor

    Wait for a locator to resolve to a single element with a given state. Defaults to the state: 'visible'.

    order_sent = page.locator("#order-sent")
    order_sent.wait_for()
    

    Read more about locator.wait_for().

    🎭 Playwright Trace Viewer

    • run trace viewer with npx playwright show-trace and drop trace files to the trace viewer PWA
    • better visual attribution of action targets

    Read more about Trace Viewer.

    Browser Versions

    • Chromium 97.0.4666.0
    • Mozilla Firefox 93.0
    • WebKit 15.4

    This version of Playwright was also tested against the following stable channels:

    • Google Chrome 94
    • Microsoft Edge 94

    (1.16.0-1634781227000)

    Source code(tar.gz)
    Source code(zip)
  • v1.15.3(Oct 5, 2021)

    Highlights

    This patch includes bug fixes for the following issues:

    https://github.com/microsoft/playwright/issues/9261 - [BUG] npm init playwright fails on path spaces https://github.com/microsoft/playwright/issues/9298 - [Question]: Should new Headers methods work in RouteAsync ?

    Browser Versions

    • Chromium 96.0.4641.0
    • Mozilla Firefox 92.0
    • WebKit 15.0

    This version of Playwright was also tested against the following stable channels:

    • Google Chrome 93
    • Microsoft Edge 93

    (driver version: 1.15.2-1633455481000)

    Source code(tar.gz)
    Source code(zip)
  • v1.15.2(Oct 1, 2021)

    Highlights

    This patch includes bug fixes for the following issues:

    https://github.com/microsoft/playwright/issues/9065 - [BUG] browser(webkit): disable COOP support https://github.com/microsoft/playwright/issues/9092 - [BUG] browser(webkit): fix text padding

    Browser Versions

    • Chromium 96.0.4641.0
    • Mozilla Firefox 92.0
    • WebKit 15.0

    This version of Playwright was also tested against the following stable channels:

    • Google Chrome 93
    • Microsoft Edge 93

    (driver version: 1.15.0-1633020276000)

    Source code(tar.gz)
    Source code(zip)
  • v1.15.1(Sep 30, 2021)

    Highlights

    This patch includes bug fixes for the following issues:

    https://github.com/microsoft/playwright/pull/8955 - [BUG] fix(inspector): stop on all snapshottable actions https://github.com/microsoft/playwright/pull/8999 - [BUG] fix: do not dedup header values https://github.com/microsoft/playwright/pull/9038 - [BUG] fix: restore support for slowmo connect option

    Browser Versions

    • Chromium 96.0.4641.0
    • Mozilla Firefox 92.0
    • WebKit 15.0

    This version of Playwright was also tested against the following stable channels:

    • Google Chrome 93
    • Microsoft Edge 93
    Source code(tar.gz)
    Source code(zip)
Owner
Microsoft
Open source projects and samples from Microsoft
Microsoft
✅ Python web automation and testing. 🚀 Fast, easy, reliable. 💠

Build fast, reliable, end-to-end tests. SeleniumBase is a Python framework for web automation, end-to-end testing, and more. Tests are run with "pytes

SeleniumBase 3k Jan 4, 2023
Generic automation framework for acceptance testing and RPA

Robot Framework Introduction Installation Example Usage Documentation Support and contact Contributing License Introduction Robot Framework is a gener

Robot Framework 7.7k Jan 7, 2023
A Demo of Feishu automation testing framework

FeishuAutoTestDemo This is a automation testing framework which use Feishu as an example. Execute runner.py to run. Technology Web UI Test pytest + se

null 2 Aug 19, 2022
pytest plugin for distributed testing and loop-on-failures testing modes.

xdist: pytest distributed testing plugin The pytest-xdist plugin extends pytest with some unique test execution modes: test run parallelization: if yo

pytest-dev 1.1k Dec 30, 2022
PENBUD is penetration testing buddy which helps you in penetration testing by making various important tools interactive.

penbud - Penetration Tester Buddy PENBUD is penetration testing buddy which helps you in penetration testing by making various important tools interac

Himanshu Shukla 15 Feb 1, 2022
PacketPy is an open-source solution for stress testing network devices using different testing methods

PacketPy About PacketPy is an open-source solution for stress testing network devices using different testing methods. Currently, there are only two c

null 4 Sep 22, 2022
A Python Selenium library inspired by the Testing Library

Selenium Testing Library Slenium Testing Library (STL) is a Python library for Selenium inspired by Testing-Library. Dependencies Python 3.6, 3.7, 3.8

Anže Pečar 12 Dec 26, 2022
Selenium-python but lighter: Helium is the best Python library for web automation.

Selenium-python but lighter: Helium Selenium-python is great for web automation. Helium makes it easier to use. For example: Under the hood, Helium fo

Michael Herrmann 3.2k Dec 31, 2022
A command-line tool and Python library and Pytest plugin for automated testing of RESTful APIs, with a simple, concise and flexible YAML-based syntax

1.0 Release See here for details about breaking changes with the upcoming 1.0 release: https://github.com/taverntesting/tavern/issues/495 Easier API t

null 909 Dec 15, 2022
Headless chrome/chromium automation library (unofficial port of puppeteer)

Pyppeteer Pyppeteer has moved to pyppeteer/pyppeteer Unofficial Python port of puppeteer JavaScript (headless) chrome/chromium browser automation libr

miyakogi 3.5k Dec 30, 2022
Simple assertion library for unit testing in python with a fluent API

assertpy Simple assertions library for unit testing in Python with a nice fluent API. Supports both Python 2 and 3. Usage Just import the assert_that

null 19 Sep 10, 2022
Hypothesis is a powerful, flexible, and easy to use library for property-based testing.

Hypothesis Hypothesis is a family of testing libraries which let you write tests parametrized by a source of examples. A Hypothesis implementation the

Hypothesis 6.4k Jan 5, 2023
Web testing library for Robot Framework

SeleniumLibrary Contents Introduction Keyword Documentation Installation Browser drivers Usage Extending SeleniumLibrary Community Versions History In

Robot Framework 1.2k Jan 3, 2023
A framework-agnostic library for testing ASGI web applications

async-asgi-testclient Async ASGI TestClient is a library for testing web applications that implements ASGI specification (version 2 and 3). The motiva

null 122 Nov 22, 2022
A cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.

PyAutoGUI PyAutoGUI is a cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard. pip inst

Al Sweigart 7.5k Dec 31, 2022
Flexible test automation for Python

Nox - Flexible test automation for Python nox is a command-line tool that automates testing in multiple Python environments, similar to tox. Unlike to

Stargirl Flowers 941 Jan 3, 2023
Akulaku Create NewProduct Automation using Selenium Python

Akulaku-Create-NewProduct-Automation Akulaku Create NewProduct Automation using Selenium Python Usage: 1. Install Python 3.9 2. Open CMD on Bot Folde

Rahul Joshua Damanik 1 Nov 22, 2021
Yet another python home automation project. Because a smart light is more than just on or off

Automate home Yet another home automation project because a smart light is more than just on or off. Overview When talking about home automation there

Maja Massarini 62 Oct 10, 2022
A folder automation made using Watch-dog, it only works in linux for now but I assume, it will be adaptable to mac and PC as well

folder-automation A folder automation made using Watch-dog, it only works in linux for now but I assume, it will be adaptable to mac and PC as well Th

Parag Jyoti Paul 31 May 28, 2021