I'm trying to go back to the previous page from the existing page from my TestCafe
code using:
await t.pressKey('alt+left');
But this doesn't seem to work. There is no change in the page. But manually when I verify in the browser, it seems to work fine.
Could someone help me with this, I want to be able to go back to the previous page using keyboard strokes alone.
TestCafe doesn't support the alt+left
key combination (see the list of supported key combinations here).
You can use the browser's History API to navigate between pages.
See an example:
import { Selector, ClientFunction } from 'testcafe';
fixture `Fixture`
.page `https://devexpress.github.io/testcafe/`;
const back = ClientFunction(() => window.history.back());
test('test', async t => {
await t.navigateTo('https://devexpress.github.io/testcafe/documentation/getting-started/');
await back();
});
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