这两个木偶操纵者的功能是否等同?

Are these 2 puppeteer functions equivalent?

这两段代码 select 和点击是同一个元素吗?

它们实际上等价吗?

await page.$eval('#loginForm > button', form => form.click());
const button = await page.$('#loginForm > button');
await button.click();

不总是。

第一个代码只使用Web-API HTMLElement.click().

第二个使用a more complicated way:

This method scrolls element into view if needed, and then uses page.mouse to click in the center of the element. If the element is detached from DOM, the method throws an error.

我在各种问题中读到,用户在不同的页面上下文中对这些方法有不同的影响。有时其中一个可以正常工作,而另一个则不能。