0

<div class="FlexItem">Jun 18th, 2021&nbsp;(one-time payment)</div>

我只有上述结构。

4

1 回答 1

1

默认情况下,cypress 接受 CSS 选择器,在这种情况下是div.FlexItem

cy.get('div.FlexItem').click()

如果你想使用 Xpath,你必须安装一个外部插件cypress-xpath

要安装插件运行命令 -

npm install -D cypress-xpath

cypress/support/index.js写 -

require('cypress-xpath')

安装后可以使用:

cy.xpath('//div[@class='FlexItem']').click()
于 2021-06-24T18:23:47.107 回答