Bug 1867810 Comment 1 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Quick note about https://searchfox.org/mozilla-central/rev/68b1b0041a78abd06f19202558ccc4922e5ba759/remote/test/puppeteer/test/src/click.spec.ts#440

The test seems to send the `click` via the frame

```js
await frame!.click('button');
```

But this relies on `[ElementHandle:click](https://searchfox.org/mozilla-central/rev/68b1b0041a78abd06f19202558ccc4922e5ba759/remote/test/puppeteer/packages/puppeteer-core/src/api/ElementHandle.ts#753-760)`:

```js
  async click(
    this: ElementHandle<Element>,
    options: Readonly<ClickOptions> = {}
  ): Promise<void> {
    await this.scrollIntoViewIfNeeded();
    const {x, y} = await this.clickablePoint(options.offset);
    await this.frame.page().mouse.click(x, y, options);
  }
```

`clickablePoint` computes coordinates relative to the topmost frame and `this.frame.page()` will return the `Page` owning the `Frame`, which is implemented using `this.mainFrame().click(...)`. So even if the test looks like it's using the frame, the actual action is dispatched to the topmost context.
Quick note about https://searchfox.org/mozilla-central/rev/68b1b0041a78abd06f19202558ccc4922e5ba759/remote/test/puppeteer/test/src/click.spec.ts#440

The test seems to send the `click` via the frame

```js
await frame!.click('button');
```

But this relies on [`ElementHandle:click`](https://searchfox.org/mozilla-central/rev/68b1b0041a78abd06f19202558ccc4922e5ba759/remote/test/puppeteer/packages/puppeteer-core/src/api/ElementHandle.ts#753-760):

```js
  async click(
    this: ElementHandle<Element>,
    options: Readonly<ClickOptions> = {}
  ): Promise<void> {
    await this.scrollIntoViewIfNeeded();
    const {x, y} = await this.clickablePoint(options.offset);
    await this.frame.page().mouse.click(x, y, options);
  }
```

`clickablePoint` computes coordinates relative to the topmost frame and `this.frame.page()` will return the `Page` owning the `Frame`, which is implemented using `this.mainFrame().click(...)`. So even if the test looks like it's using the frame, the actual action is dispatched to the topmost context.

Back to Bug 1867810 Comment 1