Skip to main content
All CollectionsDolphin AntyAPI
Basic Automation Dolphin {anty}
Basic Automation Dolphin {anty}
Updated over a month ago

General info 📜

Browser profiles based on the Anty engine support DevTools Protocol enabled startup. This allows you to connect to the profile through a port generated at startup and automate the browser using tools such as Puppeteer, Playwright, Selenium, and others.

So, basic automation involves three basic steps ⬇️

  1. Launch the profile through the API with DevTools Protocol enabled

  2. Connect to the profile port using an automation tool (Puppeteer, Playwright, Selenium, Postman, etc.).

  3. Run your own automation script via 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.

Request parameters for authorization using token:

To avoid error 401 it is necessary to send request
Method: POST
URL: http://localhost:3001/v1.0/auth/login-with-token
Header: Content-Type: application/json
Request body:

{ "token": "API_TOKEN"}

In any place where there is API_TOKEN - you need to replace it with your token (api key) from your personal cabinet on our site.

ChromeDriver ⬇️

Code examples ⚙️

JS code samples

Example code Python

Example code Java

Example code GO

If successful, the answer will be displayed:

{"success": true}

Step 1: Launch a profile via the API ▶️

Request URL

To start a browser profile via API, send a GET-request to
http://localhost:3001/v1.0/browser_profiles/PROFILE_ID/start?automation=1
You can also start a profile in headless mode:
http://localhost:3001/v1.0/browser_profiles/PROFILE_ID/start?automation=1&headless=1

  1. PROFILE_ID - ID of the browser profile. You can find out the profile ID by requesting the list of profiles via Remote API.

  2. automation=1 - mandatory parameter

Important points

  1. Local API works only when Dolphin{anty} is running

  2. This request should be sent from the PC where Dolphin{anty} is running.

  3. At the moment the local API always works on port 3001, if port 3001 is busy, then another port is occupied. It can be viewed in the Health window in the bottom line Dolphin{anty}

  4. On the free plan will not work export and import cookies via API request because there is no synchronization of profiles to the cloud.

API response

If the profile was launched successfully, the response will be about the following structure (values of port and wsEndpoint fields are approximate):

{

"success": true,

"automation": {

"port": 50568,

"wsEndpoint": "/devtools/browser/c71c1a9d-f07c-4dd9-84a9-53a4c6df9969"

}

}

Or by using the console:

Step 2: Connecting to a Profile 🔌

Puppeteer

Browser Automation with Puppeteer - SitePen

Puppeteer one of the most popular libraries for testing user interfaces in the browser, developed and maintained by the Google team.

The tool was originally created to automatically launch the browser and test interface elements to make sure everything works correctly.

In addition to the main task, the library has a wide range of capabilities to perform almost any action on web pages, making it a versatile tool for automation.

Requires knowledge of the JavaScript/Node.js stack

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

Playwright vs Selenium: What are the Main Differences and Which is Better?  - Applitools

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 - Testautomatisierung.org

Connecting Selenium to an already running browser instance is described in this article. Selenium uses a standard utility from Google - ChromeDriver - to connect to Google Chrome, but unfortunately, when using it, some sites may detect the presence of browser automation. We have made our own ChromeDriver! Download it here. You need to replace the path in the code with our version of ChromeDriver - and sites will not be able to recognize that Selenium is used. If you need to connect to the extension you need, you will not be able to 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

Did this answer your question?