当前位置:网站首页>Playwright之录制
Playwright之录制
2022-07-05 00:38:00 【dotNET跨平台】
前言
前段时间看了大佬分享的关于Playwright.NET的文章感觉挺有意思,想要阅读点击:此处,然后跟随大佬的脚步,学习了一点自动化玩,其中有一个录制功能感觉挺好玩,下面就来简单看看
介绍
手动操作浏览器,会录制我们的操作,然后生成脚本。
操作
创建项目
--创建控制台(这点需要注意,会直接安装最新版本)
dotnet new console -n PlaywrightDemo
-- 进入目录
cd PlaywrightDemo
-- 生成项目
dotnet build
-- 添加依赖包
dotnet add package Microsoft.Playwright
安装必要的浏览器(这里的netx是你当前项目的版本)
pwsh bin\Debug\netX\playwright.ps1 install
-- 示例
pwsh bin\Debug\net7.0\playwright.ps1 install
开始录制
pwsh bin\Debug\netX\playwright.ps1 codegen
-- 示例
pwsh bin\Debug\net7.0\playwright.ps1 codegen
然后会打开一个浏览器以及一个窗口,点击浏览器可以在另外的Playwright Inspector生成代码

注意:生成代码虽然很方便(简单的还是可以的),但是生成的内容需要仔细观察,有些是需要二次改动的。
如果你提示错误【 无法将“pwsh”项识别为 cmdlet、函数、脚本文件或可运行程序的名称】,那么你需要升级PowerShell
dotnet tool update --global PowerShell
资料
文档:https://playwright.dev/dotnet/docs/intro
边栏推荐
- Visual explanation of Newton iteration method
- Summary of week 22-07-02
- [paper reading] cavemix: a simple data augmentation method for brain vision segmentation
- Best practice case of enterprise digital transformation: introduction and reference of cloud based digital platform system security measures
- 实战模拟│JWT 登录认证
- Multilingual Wikipedia website source code development part II
- 两个数相互替换
- Business implementation - the log is written to the same row of data
- 2022.07.03 (LC 6109 number of people who know secrets)
- 那些一门心思研究自动化测试的人,最后都怎样了?
猜你喜欢
Relationship between classes and objects
7. Scala process control
Recursive execution mechanism
Binary conversion problem
leetcode518,377
IT转测试岗,从迷茫到坚定我究竟付出了什么?
lambda expressions
How to avoid arc generation—— Aafd fault arc detector solves the problem for you
OpenHarmony资源管理详解
Paper notes multi UAV collaborative monolithic slam
随机推荐
Design of emergency lighting evacuation indication system for urban rail transit station
Acwing164. Accessibility Statistics (topological sorting +bitset)
Hologres query management and timeout processing
P3304 [SDOI2013]直径(树的直径)
GDB常用命令
4. Scala writes HelloWorld in idea, in-depth analysis of accompanying objects, and association of source packages
Data on the number of functional divisions of national wetland parks in Qinghai Province, data on the distribution of wetlands and marshes across the country, and natural reserves in provinces, cities
Learning of basic amplification circuit
Oracle case: SMON rollback exception causes instance crash
【路径规划】RRT增加动力模型进行轨迹规划
TS快速入门-函数
Parameter passing mechanism of member methods
“薪資倒掛”、“畢業生平替” 這些現象說明測試行業已經...
Multilingual Wikipedia website source code development part II
ORB(Oriented FAST and Rotated BRIEF)
What did I pay for it transfer to testing post from confusion to firmness?
Les phénomènes de « salaire inversé » et de « remplacement des diplômés » indiquent que l'industrie des tests a...
pycharm专业版下载安装教程
MySQL uses the explain tool to view the execution plan
How many triangles are there in the golden K-line diagram?