8

是否可以从 Playwright 中的页面获取当前 url?我似乎在文档中找不到任何信息。

像这样的东西:

let url = await page.url
4

1 回答 1

8

const {browser}=this.helpers.Playwright;
await browser.pages(); //list pages in the browser

//get current page
const {page}=this.helpers.Playwright;
const url=await page.url();//get the url of the current page

于 2020-10-11T21:27:31.310 回答