How can I scroll up and scroll down using TestCafe?
I tried window.scroll()
,
window.scrollTo()
and throws an error window is not defined.
UPD: In v1.14.0 and later versions, you can use the following scroll methods: t.scroll, t.scrollBy, and t.scrollIntoView.
Old answer:
In your case, you can create your own ClientFunction
:
import { ClientFunction } from 'testcafe';
fixture `Fixture`
.page `https://github.com/DevExpress/testcafe`;
const scroll = ClientFunction(function() {
window.scrollBy(0,1500);
});
test(`test`, async t => {
await scroll();
await t.wait(1000);
});
The t.hover
action example:
// scroll to the "#some-element-scroll-to" element
await t.hover(Selector('#some-element-scroll-to'));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With