feat: expose the page getter on Frame (#8657)
* feat: expose the page getter on Frame Closes #8654 * test: add a test
This commit is contained in:
parent
dd27559090
commit
af08c5c903
@ -80,6 +80,7 @@ console.log(text);
|
||||
| [isDetached()](./puppeteer.frame.isdetached.md) | | |
|
||||
| [isOOPFrame()](./puppeteer.frame.isoopframe.md) | | |
|
||||
| [name()](./puppeteer.frame.name.md) | | |
|
||||
| [page()](./puppeteer.frame.page.md) | | |
|
||||
| [parentFrame()](./puppeteer.frame.parentframe.md) | | |
|
||||
| [select(selector, values)](./puppeteer.frame.select.md) | | Triggers a <code>change</code> and <code>input</code> event once all the provided options have been selected. |
|
||||
| [setContent(html, options)](./puppeteer.frame.setcontent.md) | | Set the content of the frame. |
|
||||
|
19
docs/api/puppeteer.frame.page.md
Normal file
19
docs/api/puppeteer.frame.page.md
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
sidebar_label: Frame.page
|
||||
---
|
||||
|
||||
# Frame.page() method
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Frame {
|
||||
page(): Page;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
[Page](./puppeteer.page.md)
|
||||
|
||||
a page associated with the frame.
|
@ -769,6 +769,13 @@ export class Frame {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns a page associated with the frame.
|
||||
*/
|
||||
page(): Page {
|
||||
return this._frameManager.page();
|
||||
}
|
||||
|
||||
/**
|
||||
* @remarks
|
||||
*
|
||||
|
@ -116,6 +116,15 @@ describe('Frame specs', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Frame.page', function () {
|
||||
it('should retrieve the page from a frame', async () => {
|
||||
const {page, server} = getTestState();
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
const mainFrame = page.mainFrame();
|
||||
expect(mainFrame.page()).toEqual(page);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Frame Management', function () {
|
||||
itFailsFirefox('should handle nested frames', async () => {
|
||||
const {page, server} = getTestState();
|
||||
|
Loading…
Reference in New Issue
Block a user