我正在使用赛普拉斯,并且遇到一些问题,因为您需要滚动才能看到它,所以该元素不可见。
我的代码看起来像这样
describe('New Team Page', () => {
it('creates a new team', () => {
CreateTeamPage.visit();
... Large form so more selectors here
// this is off the screen
// when running tests it says [data-cy=teamStadium] is not visible
cy.get('[data-cy=teamStadium]').type('Old Trafford');
})
});
[Here它的确表示在使用cypress
等DOM命令时,cy.get()
不会将元素滚动到视图中>
我看过ScrollIntoView
。这是正确的方法吗?我有点不愿意介绍它,因为它的形式很大,所以如果有其他选择的话会很棒。
我也看过ScrollIntoView
,但这是正确的方法吗?
我正在使用cypress,但由于需要滚动才能看到某个元素,因此出现一些问题。我的代码如下describe('New Team Page',()=> {it('创建新团队',()...
您可以像这样添加force: true