1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
async addMonitorEnterprise() {
const pagePromise = this.page.context().waitForEvent('page')
await this.searchInput.focus()
await this.searchInput.fill('乐视')
await expect(this.hisEntList).toBeVisible({})
await this.hisEntItem.first().click()
// 等待新页面跳转并获取新的页面
const newPage = await pagePromise
// 使用新页面的定位器
const addMonitorButton = newPage
.locator('.info-basic-box')
.getByRole('button', {
name: ' 添加监控',
})
await expect(addMonitorButton).toBeVisible()
await addMonitorButton.click()
}
|