Quick start examples for the Lexmount Node.js SDK.
- Visit the Lexmount website
- Verify the page title
- Take a screenshot
- Query the public endpoint catalog through
client.catalogInfo() - Print available regions and hosts
- Build a direct websocket URL from
LEXMOUNT_BASE_URL - Connect through
/connection?project_id=...&api_key=... - Visit
https://example.comand saveconnection_demo.png
- Create a browser session with
customImageId - Accept
--custom_image_idfrom the command line - Connect to the session and verify the browser can open a page
- Create a browser session with
windowSize - Accept
--window_size, defaulting to1920,1080 - Connect to the session and print the initial viewport
- Use
lightbrowser mode - Visit Sina News
- Extract all links and save them to
links.txt
- Create test sessions
- List sessions with pagination information
- Filter sessions by status
- Clean up sessions
- Create a context
- Start a
readWritesession with that context
- Create contexts
- List contexts
- Get details for a specific context
- Clean up created contexts
- Accept an existing source
context_id - Fork it into a new context
- Print the forked context id
- Create a read-write context session
- Demonstrate lock conflict handling through
ContextLockedError
- Create a context
- Run one
readWritesession and two concurrentreadOnlysessions
- Upload a browser extension archive
- List uploaded extensions
- Create a session with
extensionIds
- List uploaded extensions
- Get details for one extension
- Optionally upload and delete an extension when
LEXMOUNT_EXTENSION_PATHis set
- Create a session with
proxy - Verify the remote browser can access pages through the upstream proxy
- Create a session with
officialProxy: true - Verify the remote browser can access pages through the Lexmount official proxy pool
- Create a browser session
- Print the
inspectUrlfor manual inspection - Wait for user input before closing the session
- Create a browser session
- Query
/jsontargets through the SDK - Print each target's
inspectUrl, page URL, and websocket URL
- Trigger a remote file download
- Query session downloads through the SDK
- Archive session downloads to a local zip file
# 1. Install dependencies
npm install
# 2. Create .env from the template
cp .env.example .env
# Edit .env and fill in your API key and project ID
# 3. Run examples
npm run demo
npm run catalog-info
npm run connection-demo
npm run custom-image-demo -- --custom_image_id code.lexmount.net/neng/chrome:tag
npm run window-size-demo -- --window_size 1920,1080
npm run light-demo
npm run session-list
npm run context-basic
npm run context-list-get
npm run context-fork -- <context_id>
npm run context-lock-handling
npm run context-modes
npm run extension-basic
npm run extension-list-get
npm run proxy-demo
npm run official-proxy-demo
npm run inspect-url-demo
npm run session-targets
npm run session-downloadsThe .env file should contain:
LEXMOUNT_API_KEY=your_api_key_here
LEXMOUNT_PROJECT_ID=your_project_id_here
LEXMOUNT_BASE_URL=https://api.lexmount.cn
LEXMOUNT_EXTENSION_PATH=/absolute/path/to/extension.zip
LEXMOUNT_PROXY_SERVER=http://host:port
LEXMOUNT_PROXY_USERNAME=
LEXMOUNT_PROXY_PASSWORD=
LEXMOUNT_CUSTOM_IMAGE_ID=code.lexmount.net/neng/chrome:tag
LEXMOUNT_WINDOW_SIZE=1920,1080