Skip to content

Commit

Permalink
add: 增加获取cookie的示例
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouyuan63 committed Nov 12, 2024
1 parent b66e536 commit 9a83cf3
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/guide/exam/problem.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,25 @@
await page.setBrowserCofing({ignoreHTTPSErrors:true})
// ....其他代码
```

## 获取playwright原生控件

获取pw原生控件可以加强对页面操作的定制化, `yintao` 通过对pw进行封装来自动完成调度。

结构如下,可通过`page.control` 来获取 `TestControl` 对象. [更多用法参考](https://playwright.dev/docs/api/class-browsercontext#browser-context-cookies)

```js
class TestControl {
runContext: Page | Frame | undefined
browserContext: BrowserContext | undefined
currentPage: Page | undefined
browser: Browser
id: string
}
```

```js

// export: 获取浏览器的cookeis信息
let cookies = await page.control.browserContext.cookies();
```

0 comments on commit 9a83cf3

Please sign in to comment.