Getting started with Kameleo Automation

  • Created

In this article, you can get a brief overview of how Kameleo works, and how you can automate browser activities in the shortest timeframe.

We highly recommend getting familiar with the graphical interface first and reading the Terminology article as well.

How Kameleo works

Kameleo consists of multiple components running on your computer and in the cloud. The core logic is implemented in the Kameleo CLI component, located on your device. This component is responsible for every action you do in the application. For example, it starts the preconfigured browsers and saves their actual state into virtual browser profile files. Once you start this component, a REST API is available on the local interface (by default, it is on http://localhost:5050). You can check the available endpoints and models on SwaggerHub or by opening the http://localhost:5050/swagger URL.

Architectural diagram of Kameleo
Architectural diagram of Kameleo

When you start Kameleo from the Start menu, the GUI component starts. This provides an easy-to-use interface for the CLI component. So whatever you can do on the graphical interface can be achieved using REST API calls.

Supported languages and frameworks

Once you start the Kameleo CLI, you can call the available endpoints from any programming language, but for your convenience, we created Local API packages in the following programming languages:

  • Javascript / Node.js
  • C# / .NET
  • Python

This will make more accessible the use of Kameleo Local API for you. It allows you to create virtual browser profiles with recommended defaults, but you can simply override any settings. See the available options in our example codes.

Once you have created and started a profile, the browser launches, and you can operate them with a popular framework, such as Selenium, Puppeteer, or Playwright. These frameworks are available in several programming languages. You will find a suitable programming language that will work with Kameleo and a popular automation framework.

Framework Launched Browser Javascript / Node.js Python C# / .NET
Selenium Chromium-based View on GitHub View on GitHub View on GitHub
Firefox Example code not available Example code not available Example code not available
Puppeteer Chromium-based View on GitHub View on GitHub View on GitHub
Firefox Not Supported Not Supported Not Supported
Playwright Chromium-based View on GitHub View on GitHub View on GitHub
Firefox View on GitHub View on GitHub View on GitHub

Starting your first virtual browser profile

In this example, we are going to showcase how easy it is to automate browser actions with Kameleo.

  1. First, you need to start Kameleo.CLI.exe

    Simply navigate to the Kameleo application folder (by default: C:\Users\<YOUR_USERNAME>\AppData\Programs\Kameleo) and start Kameleo with the following command:

    Kameleo.CLI.exe email=<YOUR_EMAIL> password=<YOUR_PASSWORD>
  2. You need to install one of our packages.

    • npm i @kameleo/local-api-client
    • Install-Package Kameleo.LocalApiClient
    • pip install kameleo.local-api-client
  3. You need to connect to the Kameleo.CLI component. By default, it is listening on 5050, but can be overridden in the appsettings.json file.

    • const {
        KameleoLocalApiClient,
        BuilderForCreateProfile
      } = require('@kameleo/local-api-client');
      
      const kameleoPort = 5050;
      const client = new KameleoLocalApiClient({
        baseUri: `http://localhost:${kameleoPort}`,
        noRetryPolicy: true,
      });
    • using Kameleo.LocalApiClient;
      using Kameleo.LocalApiClient.Models;
      
      const int KameleoPort = 5050;
      var client = new KameleoLocalApiClient(new Uri($"http://localhost:{KameleoPort}"));
      client.SetRetryPolicy(null);
    • from kameleo.local_api_client.kameleo_local_api_client import KameleoLocalApiClient
      from kameleo.local_api_client.builder_for_create_profile import BuilderForCreateProfile
      from kameleo.local_api_client.models.webgl_spoofing_options_py3 import WebglSpoofingOptions
      
      kameleo_port = 5050
      client = KameleoLocalApiClient(f'http://localhost:{kameleo_port}')
  4. You can filter and search base profiles.

    • const chromeBaseProfileList = await client.searchBaseProfiles({
        deviceType: 'desktop',
        browserProduct: 'chrome',
        language: 'en-en',
      });
    • var baseProfileList = await client.SearchBaseProfilesAsync(
        deviceType: "desktop",
        browserProduct: "chrome",
        language: "en-en"
      );
    • base_profiles = client.search_base_profiles(
        device_type='desktop',
        browser_product='chrome',
        language='en-en'
      )
  5. Choose one of the Base Profiles. Create a new profile with recommended settings and setup here the exact configuration.

    • const createProfileRequest = BuilderForCreateProfile
        .forBaseProfile(chromeBaseProfileList[0].id)
        .setRecommendedDefaults()
        .setWebgl('noise', {
          vendor: 'Google Inc.',
          renderer: 'ANGLE (Intel(R) HD Graphics 630 Direct3D11 vs_5_0 ps_5_0)'
        })
        .setPasswordManager('enabled')
        .setStartPage('https://kameleo.io')
        .build();
      
      const profile = await client.createProfile({ body: createProfileRequest });
    • var createProfileRequest = BuilderForCreateProfile
        .ForBaseProfile(baseProfileList[0].Id)
        .SetWebgl(
          "noise",
          new WebglSpoofingOptions("Google Inc.", "ANGLE (Intel(R) HD Graphics 630 Direct3D11 vs_5_0 ps_5_0)"))
        .SetPasswordManager("enabled")
        .SetStartPage("https://kameleo.io")
        .Build();
      
      var profile = await client.CreateProfileAsync(createProfileRequest);
    • create_profile_request = BuilderForCreateProfile \
        .for_base_profile(base_profiles[0].id) \
        .set_recommended_defaults() \
        .set_webgl(
          "noise",
          WebglSpoofingOptions(
            vendor='Google Inc.',
            renderer='ANGLE (Intel(R) HD Graphics 630 Direct3D11 vs_5_0 ps_5_0)')) \
        .set_start_page("https://kameleo.io") \
        .set_password_manager("enabled") \
        .build()
      
      profile = client.create_profile(body=create_profile_request)
  6. Launch the browser for the profile

    • await client.startProfile(profile.id);
    • await client.StartProfileAsync(profile.Id);
    • client.start_profile(profile.id)

If you want to see the full example code, click any of the links below:

Headless browser support

To save computer resources it is possible to run browsers in headless mode while you do browser automation. When it comes to browser fingerprint spoofing, the headless opportunity is not so trivial.

Currently, we only support headless mode with Firefox browser launcher but our team is working hard to be able to support the Chromium-based browsers as well.

To launch Firefox in the headless mode you will need to pass additional settings when you start the virtual browser profile. You can do it by calling the POST /profiles/{guid}/start endpoint or simply call the StartProfileWithWebDriverSettings method in our packages.

  • await client.startProfileWithWebDriverSettings(profile.id, {
        body: {
            argumentsProperty: [
                '--headless',
            ],
    });
  • await client.StartProfileWithWebDriverSettingsAsync(profile.Id, new WebDriverSettings
    {
        Arguments = new List { "--headless" },
    });
  • from kameleo.local_api_client.models.web_driver_settings_py3 import WebDriverSettings
    
    client.start_profile_with_web_driver_settings(profile.id, WebDriverSettings(
        arguments=["--headless"]
    ))

Browser extension support

If you want to install a browser extension to a Chromium-based browser or you want to install an Add-on to Firefox we recommend you to use Kameleo's dedicated feature for this. In the virtual browser profile's settings, you can specify which browser extensions you would like to install to the browser, before starting it. This way the extensions will be portable and once you move a saved .profile file to another computer it will work smoothly as well.

Chromium-based browsers use .crx files to store extensions. Firefox uses .xpi files for AddOns. Please see this article for more information on downloading these types of files.

  • const createProfileRequest = BuilderForCreateProfile
        .forBaseProfile(chromeBaseProfileList[0].id)
        .setRecommendedDefaults()
        .setExtensions(["<ABSOLUTE_PATH_TO_EXTENSION_1>", "<ABSOLUTE_PATH_TO_EXTENSION_2>"])
        .build();
    const profile = await client.createProfile({ body: createProfileRequest });
  • var createProfileRequest = BuilderForCreateProfile
        .ForBaseProfile(baseProfileList[0].Id)
        .SetExtensions(new List { "<ABSOLUTE_PATH_TO_EXTENSION_1>", "<ABSOLUTE_PATH_TO_EXTENSION_2>" })
        .Build();
    var profile = await client.CreateProfileAsync(createProfileRequest);
  • create_profile_request = BuilderForCreateProfile \
        .for_base_profile(base_profiles[0].id) \
        .set_recommended_defaults() \
        .set_extensions(["<ABSOLUTE_PATH_TO_EXTENSION_1>", "<ABSOLUTE_PATH_TO_EXTENSION_2>"]) \
        .build()
    profile = client.create_profile(body=create_profile_request)

Please be advised we do not recommend installing any browser fingerprint modifier extensions, as they can interfere with Kameleo’s spoofing mechanism.

Further example codes

You'll find a variety of ready-to-run example codes and practical recipes along with tips in this article.

Was this article helpful?

1 out of 2 found this helpful