Protractor browser navigation commands ?
We have 4 navigate methods in protractor:
- back() - It is used to navigate to backward web page in browser history.
- forward() - It is used to navigate to forward web page in browser history.
- refresh() - It is used to refresh the current web page
- to() - It is used to navigate to new url.
Please check below code script:
describe('Protractor - navigate()', function () {
beforeAll(async function () {
await browser.get("https://keeplearners.blogspot.com/");
});
it('Code script to use navigate() in protractor', async function () {
await browser.navigate().to("https://keeplearners.blogspot.com/2018/03/Angular-elements.html");
await console.log("Navigated to url");
await browser.navigate().back();
await console.log("Navigated to previous(back) page");
await browser.navigate().forward();
await console.log("Navigated to forward page");
await browser.navigate().refresh();
await console.log("Refreshed the current web page");
});
});
Output:
protractor navigation methods |
Please comment below to feedback or ask questions.
No comments:
Post a Comment
Please comment below to feedback or ask questions.