tomoyachen / playwright-test Goto Github PK
View Code? Open in Web Editor NEWplaywright-test + pytest demo
playwright-test + pytest demo
通常为了在一个测试类里面执行多条测试用例,并且共用一个浏览器页面,我会定义 page 为 class 作用域。
但是 Playwright 录制视频需要 page.context.close()
这就导致了 如果有一条用例失败后,后续的同一测试类中其他 function 也会因为 page 被提前关闭而执行失败。
@pytest.fixture(scope="class")
def page(browser: Browser):
page:Page = browser.new_page(record_video_dir='./videos')
yield page
page.close()
poetry install
有时报:
[Errno 13] Permission denied: '\Scripts\ucrtbase.dll
或这个错
PermissionError
[WinError 5] 拒绝访问。: 'd:\anaconda3\ucrtbase.dll' -> 'C:\Users\xxx\AppData\Local\pypoetry\Cache\virtualenvs\playwright-test-IPShjk7t-py3.8\Scripts\ucrtbase.dll'
使用python -m poetry install即可
你好,请问下,
使用了
import pytest
from playwright.async_api import Page
写了一个登录方法,如何保持这个登录,进行后续测试呢?
不同.py文件
默认chrome,如何换Firefox,或其他浏览器或手机呢?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.