当前位置:网站首页>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
边栏推荐
- Getting started with Paxos
- “薪资倒挂”、“毕业生平替” 这些现象说明测试行业已经...
- Date time type and format in MySQL
- 兩個數相互替換
- 2022.07.03(LC_6111_统计放置房子的方式数)
- 【Unity】InputSystem
- Nine Qi single chip microcomputer ny8b062d single key control four LED States
- P4408 [noi2003] truant children (tree diameter)
- Significance of acrel EMS integrated energy efficiency platform in campus construction
- Summer challenge brings you to play harmoniyos multi terminal piano performance
猜你喜欢
leetcode494,474
The company needs to be monitored. How do ZABBIX and Prometheus choose? That's the right choice!
Oracle case: SMON rollback exception causes instance crash
Identifiers and keywords
程序员SQL数据脚本编码能力弱,BI做不出来怎么办?
Hisilicon 3559 universal platform construction: YUV422 pit stepping record
Paper notes multi UAV collaborative monolithic slam
企业公司项目开发好一部分基础功能,重要的事保存到线上第一a
abc 258 G - Triangle(bitset)
JS how to realize array to tree
随机推荐
Huawei employs data management experts with an annual salary of 2million! The 100 billion market behind it deserves attention
Learn C language from scratch day 024
Verilog tutorial (11) initial block in Verilog
Summary of week 22-07-02
2022.07.03 (lc_6111_counts the number of ways to place houses)
【Unity】InputSystem
Getting started with Paxos
Mongodb series learning notes tutorial summary
Apifox (postman + swagger + mock + JMeter), an artifact of full stack development and efficiency improvement
Introduction to ACM combination counting
Acwing164. Accessibility Statistics (topological sorting +bitset)
Detailed explanation of openharmony resource management
打新债开户注册安全吗?有没有风险的?靠谱吗?
How many triangles are there in the golden K-line diagram?
实战模拟│JWT 登录认证
Ruby tutorial
lambda表达式
skimage: imread & imsave & imshow
Reasons and solutions of redis cache penetration and avalanche
Hisilicon 3559 universal platform construction: YUV422 pit stepping record