📜General information
Browser profiles based on the Anty engine can be loaded with the DevTools protocol enabled.
This means that after starting the profile, you can connect to it through the port generated at startup and the ability to connect using tools like Puppeteer, Playwright, Selenium, etc. Learn more about the DevTools protocol .
Thus, basic automation consists of three steps:
1. Run the profile through the API with DevTools protocol enabled.
2. Connect to the profile port using a tool (Puppeteer, Playwright, Selenium, Postman, etc.).
3. Run your own automation script through an open connection.
Dolphin Anty must be running and authorized to work. Authorization can be done either by login and password or by software request using a token. You can create a token in your personal cabinet.
Parameters of the request for authorization using a token:
In order not to get a 401 error, be sure to send a request
Method: POST
URL: http://localhost:3001/v1.0/auth/login-with-token
Header: Content-Type: application/json
Request body:
{ "token": "API_TOKEN"}
API_TOKEN
- change to a token
Example code JS
Example code Python
Example code Java
Example code GO
If the code is successfully executed, you will get a response:
{"success": true}
💪Step 1: Launch a profile via the API
URL-request
To start a browser profile via API you need to send a GET-request to :
http://localhost:3001/v1.0/browser_profiles/PROFILE_ID/start?automation=1Так profile can also be downloaded in headless
mode:http://localhost:3001/v1.0/browser_profiles/PROFILE_ID/start?automation=1&headless=1
Important points
The local API only works when Dolphin Anty is running
This request has to be sent from the computer where Dolphin Anty is running
At the moment the local API is always running on port 3001. If port 3001 is busy you will have to use another port. This can be seen in the Health / Health window on the bottom row of Dolphin Anty
On Free plan will not work export and import cookies via API request because there is no synchronization of profiles to the cloud
In the future it will be possible to run the profile remotely via API
PROFILE_ID
- Browser profile ID. you can find out the profile ID by requesting the profile list path via Remote APIautomation=1
- mandatory parameter
API response
If the profile was successfully started, the response will be about the following structureа (field values port
and wsEndpoint
approximate):
{
"success": true,
"automation": {
"port": 50568,
"wsEndpoint": "/devtools/browser/c71c1a9d-f07c-4dd9-84a9-53a4c6df9969"
}
}
🔌Step 2: Connecting to a Profile
Puppeteer
Puppeteer is one of the most common libraries for food interfaces in the browser. The development and support of this library by Google.
The purpose of the tool is to use it automatically on an interface element by element, to check if everything is OK.
Side functionality - almost unlimited possibilities to perform almost any action on web pages.
Requires knowledge of tumblrJavaScript/Node.js
const puppeteer = require('puppeteer-core');
(async () => {
// HERE YOUR port
const port = 50568;
// HERE YOUR wsEndpoint
const wsEndpoint = '/devtools/browser/c71c1a9d-f07c-4dd9-84a9-53a4c6df9969';
// IMMEDIATE CONNECTION
const browser = await puppeteer.connect({
browserWSEndpoint: `ws://127.0.0.1:${port}${wsEndpoint}`
});
// FROM THIS POINT ON, AUTOMATE WHATEVER WE WANT.
// FOR EXAMPLE, TAKE A SCREENSHOT FROM GOOGLE.
const page = await browser.newPage();
await page.goto('https://google.com');
await page.screenshot({ path: 'google.png' });
await browser.close();
})();
Playwright
In fact, Playwright is a more modern and up-to-date counterpart of Puppeteer. It is developed by Microsoft. It has rare functionality and syntax.
const { chromium } = require('playwright');
(async () => {
// HERE YOUR port
const port = 50568;
// HERE YOUR wsEndpoint
const wsEndpoint = '/devtools/browser/c71c1a9d-f07c-4dd9-84a9-53a4c6df9969';
// IMMEDIATE CONNECTION
const browser = await chromium.connectOverCDP(`ws://127.0.0.1:${port}${wsEndpoint}`);
// FROM THIS POINT ON, AUTOMATE WHATEVER WE WANT.
// FOR EXAMPLE, TAKE A SCREENSHOT FROM GOOGLE.
const page = await browser.contexts()[0].newPage();
await page.goto('https://google.com');
await page.screenshot({path: 'google.png'});
await browser.close();
})();
Selenium
Selenium accesses the already running instance in this article .
Selenium uses a standard utility from Google -- Google ChromeDriver -- to connect to Google Chrome. Unfortunately, to block access to the banking system. We made our own ChromeDriver! You can download it here . You need to use the following path in the code of our version of ChromeDriver -- and sites won't reveal that you're using Selenium. If you want to connect to the extension you need, then you can't do it, because it is not available in our browser
⛔️Step 3: Stopping the profile via API
To stop a browser profile via API you need to send a GET-request to
http://localhost:3001/v1.0/browser_profiles/PROFILE_ID/stop