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 Chroma View on GitHub View on GitHub View on GitHub
Junglefox Example code not available Example code not available Example code not available
Puppeteer Chroma View on GitHub View on GitHub View on GitHub
Junglefox Not Supported Not Supported Not Supported
Playwright Chroma View on GitHub View on GitHub View on GitHub
Junglefox View on GitHub View on GitHub View on GitHub

*Launched browser: Chroma is used to emulate Chrome, Edge, Safari and Mobile profiles. Junglefox is used for Firefox profiles.

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

    • Simply navigate to the Kameleo application folder. By default:

      cd C:\Users\<YOUR_USERNAME>\AppData\Local\Programs\Kameleo

      And start Kameleo.CLI with the following command:

      Kameleo.CLI.exe email=<YOUR_EMAIL> password=<YOUR_PASSWORD>
    • Simply navigate to the Kameleo application folder. By default:

      cd /Applications/Kameleo.app/Contents/Resources/CLI/

      And start Kameleo.CLI with the following command:

      ./Kameleo.CLI 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 import KameleoLocalApiClient
      from kameleo.local_api_client.builder_for_create_profile import BuilderForCreateProfile
      from kameleo.local_api_client.models import WebglMetaSpoofingOptions
      
      kameleo_port = 5050
      client = KameleoLocalApiClient(
        endpoint=f'http://localhost:{kameleo_port}',
        retry_total=0
      )
  4. You can filter and search base profiles.

    • const chromeBaseProfileList = await client.searchBaseProfiles({
        deviceType: 'desktop',
        browserProduct: 'chrome',
        language: 'en-us',
      });
    • var baseProfileList = await client.SearchBaseProfilesAsync(
        deviceType: "desktop",
        browserProduct: "chrome",
        language: "en-us"
      );
    • base_profiles = client.search_base_profiles(
        device_type='desktop',
        browser_product='chrome',
        language='en-us'
      )
  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()
        .setName('create profile example')
        .setCanvas('intelligent')
        .setWebglMeta(
          'manual',
          {
            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)
        .SetName("create profile example")
        .SeCanvas("intelligent")
        .SetWebglMeta("manual",new WebglMetaSpoofingOptions("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_name('create profile example') \
        .set_recommended_defaults() \
        .set_webgl_meta('manual', WebglMetaSpoofingOptions(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.

To launch 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 StartProfileWithOptions method in our packages.

  • await client.startProfileWithOptions(profile.id, {
        body: {
            arguments: [
                '--headless',
            ],
    } });
  • await client.StartProfileWithOptionsAsync(profile.Id, new WebDriverSettings
    {
        Arguments = new List { "--headless" },
    });
  • from kameleo.local_api_client.models.web_driver_settings_py3 import WebDriverSettings
    
    client.start_profile_with_options(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)
        .setName('create profile example')
        .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)
        .SetName("create profile example")
        .SetRecommendedDefaults()
        .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_name('create profile example') \
        .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?

2 out of 6 found this helpful