最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Is it possible to click the back button in the browser using Playwright? - Stack Overflow

programmeradmin1浏览0评论

In a browser there's often arrow buttons that go forward and backward in history:

Can these buttons be clicked on via playwright?

There's no elements for them so I was wondering if this is possible...

await navigationObject(page).backButton.click();

In a browser there's often arrow buttons that go forward and backward in history:

Can these buttons be clicked on via playwright?

There's no elements for them so I was wondering if this is possible...

await navigationObject(page).backButton.click();
Share Improve this question edited Nov 3, 2022 at 18:22 tenshi 26.3k4 gold badges27 silver badges60 bronze badges asked Nov 3, 2022 at 15:28 Sundeep SandhuSundeep Sandhu 911 gold badge1 silver badge4 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 17

For nodejs

await page.goBack()

Or

await page.goForward()

For python

await page.go_back()

Or

await page.go_forward()

You can find more info here: https://playwright.dev/docs/api/class-page#page-go-back

Try the History API:

window.history.back()

and

window.history.forward()

See: https://developer.mozilla.org/en-US/docs/Web/API/History_API

发布评论

评论列表(0)

  1. 暂无评论