当前位置: 首页 > news >正文

AI开发playwright tool提示词

[TASK]
生成一个isModuleElementObject function,若element的qa-test class在对象moduleObj {"qa-test-mycourses-course": "qa-test-mycourses-course-title", "qa-test-discussion-module": "qa-test-discussion-description", "qa-test-reply-module": "qa-test-reply-description"}的key中,返回该key的value
生成一个getModuleText function,根据`.${value}`得到elementList,并返回所有element的textList
生成一个getUniqueLocatorsInModule function,传入rootElement,按照以下规则生成该元素下所有节点:
1.调用getModuleText,并根据text得到rootElement的uniqueLocator `${rootElement.locator}:has-text("${text}") ${element.locator}`
2.遍历每个子节点element,判断是否moduleElementsObject
2.当class包含qa-test时,获取该子节点的locator, 并返回
3.用isUnique判断,若元素唯一,则加入全局数组中

[Example]
以下是rootElement及其后代节点的信息,提供参考
<div class="qa-test-mycourses-course"><div class="tw-block tw-bg-white tw-p-4 tw-rounded-lg tw-shadow-lg"><a class="tw-block" title="AOS_BROWSE_Course028" href="/training/03374f80-07aa-4f60-b826-9b90810dcad3"><div class="qa-test-mycourses-course-title tw-text-2xl tw-text-black tw-font-extrabold tw-my-4 tw-line-clamp-1">AOS_BROWSE_Course028</div><div class="tw-flex tw-items-center"><svg width="12" height="13" fill="none" xmlns="http://www.w3.org/2000/svg" class="tw-align-middle tw-inline-block tw-mr-2"><path d="M3 9.5h3V8H3v1.5Zm0-2.25h6v-1.5H3v1.5ZM3 5h6V3.5H3V5Zm-1.5 7.5c-.413 0-.766-.147-1.06-.44A1.445 1.445 0 0 1 0 11V2c0-.413.147-.766.44-1.06C.735.648 1.088.5 1.5.5h9c.412 0 .766.147 1.06.44.293.294.44.647.44 1.06v9c0 .412-.147.766-.44 1.06-.294.293-.648.44-1.06.44h-9Zm0-1.5h9V2h-9v9Z" fill="#31728C"></path></svg><span class="tw-text-teal tw-font-extrabold">Course</span></div><div class="qa-test-mycourses-course-description tw-my-2 tw-text-black tw-text-base tw-line-clamp-1 tw-h-6">This is a course</div><div><div class="tw-h-1.5 tw-bg-line-1 tw-rounded-full tw-my-4 tw-overflow-hidden"><div class="tw-bg-medium-teal tw-h-full" style="width: 25%;"></div></div><div class="qa-test-mycourses-course-complete-status tw-flex tw-justify-between"><div>1 / 4 lessons completed</div><div>25% completed</div></div></div><div class="tw-my-4"><img class="tw-object-cover tw-h-[225px] tw-w-full qa-test-mycourses-course-cover" src="/img/default_cover.8c5844d2.png?x-bce-process=image/format,f_auto"></div></a><button type="input" class="qa-test-mycourses-learn-button tw-w-full tw-text-left"><div class="tw-flex tw-justify-between tw-items-center tw-my-3"><div class="tw-text-lg tw-text-black tw-font-extrabold">Next activity</div></div><div class="tw-my-2 tw-font-extrabold tw-text-teal tw-text-base tw-min-h-6">Lesson 1.2</div><div class="tw-mt-4 tw-rounded-full tw-text-center tw-leading-10 tw-border tw-border-teal tw-text-teal tw-font-extrabold">Continue learning</div></button></div></div>

相关文章:

  • 读《暗时间》有感
  • 【C++】类和对象【下】
  • Linux 驱动开发步骤及 SPI 设备驱动移植示例
  • chili调试笔记13 工程图模块 mesh渲染 mesh共享边显示实现
  • 藏文智能输入入门实践-简单拼写纠错
  • 【Agent】使用 Python 结合 OpenAI 的 API 实现一个支持 Function Call 的程序,修改本机的 txt 文件
  • 光伏“531”政策倒逼下,光储充一体化系统如何破解分布式光伏收益困局?
  • VMware更改语言设置
  • 使用Go语言对接全球股票数据源API实践指南
  • 【C++进阶】第1课—继承
  • 【软件设计师:数据结构】1.数据结构基础(一)
  • 【Bootstrap V4系列】学习入门教程之 组件-轮播(Carousel)高级用法
  • linux基础学习--linux磁盘与文件管理系统
  • OC的实例对象,类对象,元类对象
  • 外包团队协作效率低,如何优化
  • python打卡day18
  • 【一篇详解】深入浅出RabbtiMQ消息队列
  • openstack的网络
  • 第十六次博客打卡
  • Qt开发经验 --- 避坑指南(6)
  • 司法部谈民营经济促进法:对违规异地执法问题作出禁止性规定
  • 上交现场配乐4K修复版《神女》:默片巅峰有了新的打开方式
  • 中国驻美国大使馆发言人就中美经贸高层会谈答记者问
  • 经济日报:降准降息,提前还房贷划算吗?
  • 秦洪看盘|受阻回落,蓄积新做多能量
  • 应对美政策调整:中国重在开放与创新,维护好数据主权