Setup & Config
Before writing your first line of code, we need to prepare the base environment.
1. Install Node.js
Puppeteer runs in a Node.js environment.
- Download: Go to the Node.js Official Website to download and install the LTS version.
- Verify Installation: Open your terminal or command prompt and enter:bashIf version numbers are displayed, the installation was successful.
node -v npm -v
2. Install Puppeteer
In your project folder, run the following command (we recommend puppeteer-core because it is lightweight and does not require downloading extra Chromium; we will use the kernel built into Mbbrowser):
bash
npm install puppeteer-core3. Enable Mbbrowser ApiServer
Mbbrowser's API functionality is implemented through ApiServer.exe.
- Locate File: Enter the main installation directory of Mbbrowser.
- Get Authentication Info:
- Log in to the Mbbrowser client.
- Go to "Personal Center" -> "API Settings."
- Obtain your
APP_IDandAPP_KEY.
- Start via Command Line: In the Mbbrowser installation directory, open a terminal with administrator privileges and run:bash
apiserver.exe --port=8186 --app_id=YOUR_ID --app_key=YOUR_KEY --hide=off--port: Interface listening port (default 8186).--hide=off: Set tooffif you want to see the browser window running.
4. Obtain Interface Documentation
After ApiServer starts, you can visit http://127.0.0.1:8186/ to view the list of all available HTTP interfaces.
IMPORTANT
During automation, please ensure that the ApiServer.exe terminal window is not closed.
TIP
Environment ready? The next chapter Quick Start: Connect will teach you how to write your first script.
