# UI_playwright
**Repository Path**: personalgu/ui_playwright
## Basic Information
- **Project Name**: UI_playwright
- **Description**: No description available
- **Primary Language**: Python
- **License**: MPL-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2024-10-14
- **Last Updated**: 2024-10-14
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# playwright自动化框架说明文档
## 一、安装 (python)
环境依赖`Python >= 3.7`
1. 在线安装
```
- 安装playwright
pip install playwright
- 安装内置浏览器
playwright install
```
2、离线安装
- 首先使用`代理`或者`whl离线包`安装安装`playwright`
- 获取安装内置浏览器过程链接,外网下载浏览器包,导入内网
- 编写脚本,启动浏览器并获取读取路径,将外网下载包解压放入
## 二、编写脚本
```
import time
from playwright.sync_api import sync_playwright
# 上下文管理,启动时自动调用__enter__, 结束时调用__exit__关闭浏览器
with sync_playwright() as p:
# 启动浏览器
browser = p.chromium.launch(headless=False)
# 创建上下文
context = browser.new_context()
# 创建页面
page = context.new_page()
# 打开网页
page.goto('http://192.88.1.97:8083/')
```
## 三、用例录制功能
```
playwright codegen
```
## 四、链接
- 开发文档: https://playwright.nodejs.cn/docs/intro
- github: https://github.com/microsoft/playwright