如何将鼠标悬停在赛普拉斯的父元素和子元素上
How to mouse over a parent and child element in cypress
我正在尝试使用 cypress 自动化 orangehrm 网站
(https://opensource-demo.orangehrmlive.com/index.php/auth/login)
我的用例
- 登录应用程序
- 将鼠标悬停在性能选项卡上。
- 将鼠标悬停在配置上
- 查找并单击 KPI
我尝试使用 cypress,但不知何故鼠标悬停无法正常工作。
请建议点击KPI的最佳方式link.
截图
cypress-real-events 库悬停命令工作正常
cy.get('#menu__Performance')
.realHover()
cy.contains('#menu_performance_Configure', 'Configure')
.realHover()
cy.contains('#menu_performance_searchKpi', 'KPIs')
.click({force:true})
cy.contains('h1', 'Search Key Performance Indicators')
备注
最后一个命令需要 force
因为确实会发生元素裁剪。
安装
npm install cypress-real-events
//or
yarn add cypress-real-events
cypress/support/index.js
import "cypress-real-events/support";
我正在尝试使用 cypress 自动化 orangehrm 网站 (https://opensource-demo.orangehrmlive.com/index.php/auth/login)
我的用例
- 登录应用程序
- 将鼠标悬停在性能选项卡上。
- 将鼠标悬停在配置上
- 查找并单击 KPI
我尝试使用 cypress,但不知何故鼠标悬停无法正常工作。 请建议点击KPI的最佳方式link.
截图
cypress-real-events 库悬停命令工作正常
cy.get('#menu__Performance')
.realHover()
cy.contains('#menu_performance_Configure', 'Configure')
.realHover()
cy.contains('#menu_performance_searchKpi', 'KPIs')
.click({force:true})
cy.contains('h1', 'Search Key Performance Indicators')
备注
最后一个命令需要 force
因为确实会发生元素裁剪。
安装
npm install cypress-real-events
//or
yarn add cypress-real-events
cypress/support/index.js
import "cypress-real-events/support";