Category: JavaScript

Sep 10, 2023

Puppeteer page.evaluate的使用详解

`page.evaluate()` 是 Puppeteer 提供的方法,用于在页面上下文中执行 JavaScript 代码以获取数据或执行操作,并返回执行结果。

Read more
Sep 10, 2023

Puppeteer 等待元素渲染

Puppeteer中可通过page.waitForSelector()、page.waitFor()或page.waitForFunction()方法等待元素渲染,根据需求选择合适的方法。

Read more
Sep 10, 2023

puppeteer-firefox Puppeteer 启动Firefox

要在Puppeteer中使用Firefox浏览器,需安装`pptr-firefox` npm包,并通过示例代码启动浏览器、创建页面、导航和关闭浏览器,同时确保Firefox已安装并添加到系统PATH。

Read more
Sep 10, 2023

Puppeteer如何与现有的Chrome实例进行交互?

Puppeteer通过调用`connect()`方法并提供Chrome实例的WebSocket地址,可以与现有Chrome实例交互,实现页面操作和截图等功能。

Read more
Sep 10, 2023

How to construct a WebSocket URI relative to the page URI?

To construct a WebSocket URI relative to the current page's URI, extract the page's protocol, hostname, and port, then combine them with the appropriate WebSocket protocol using JavaScript.

Read more
PreviousNext