id属性定位
例:id=account
cy.get(‘#account’)
class属性定位
例:class=form-control
cy.get(‘.form-control’)
attributes属性选择器
例
cy.get(‘[input[id=“acount”"]]’)
:nth-child(n)
例tbody的第N个子元素
cy.get(tbody > tr:nth-child(1) > th’)
Cypress:
定位(
j
Q
u
e
r
y
选择定位器
)
C
y
p
r
e
s
s
.
定位(jQuery选择定位器) Cypress.
定位(jQuery选择定位器)Cypress.(‘#account’)相当于cy.get(‘#acount’)
个人认为这个方法就是语法上的不同,可以用jQuery这个,会的应该很好用,这个要自己使用过后才能体会效果如何。