How to pass profile preferences to the browser?

  • Created

We recommend that you read the Getting started with Kameleo Automation article before reading this one.

With Kameleo you can fine-tune the browsers and you can pass most of the options, and preferences that are supported by the browsers. You need to start the browser with POST /profiles/{guid}/start endpoint and pass preferences and additionalOptions to it. See the documentation on SwaggerHub.

You can set a list of preferences for browsers at startup. In the case of Chromium-based browsers, it will be a user profile preference. In the case of Firefox profiles, it will be a preference.

You can also set a list of additional options at startup. These are values that are defined by our team.

This way you can simply save network traffic by disabling images.

  • await client.startProfileWithOptions(profile.id, {
      body: {
        preferences: [
          {
            key: 'profile.managed_default_content_settings.images',
            value: 2,
          },
        ],
        additionalOptions: [
          {
            key: 'disableTouchEmulation',
            value: true,
          },
        ],
      },
    });

    See full example here.

  • await client.StartProfileWithOptionsAsync(profile.Id, new WebDriverSettings
    {
      Preferences = new List<Preference>
      {
        new Preference("profile.managed_default_content_settings.images", 2),
      },
      AdditionalOptions = new List<Preference>
      {
        new Preference("disableTouchEmulation", true),
      }
    });

    See full example here.

  • client.start_profile_with_options(profile.id, WebDriverSettings(
      preferences=[
        Preference(key='profile.managed_default_content_settings.images', value=2),
      ],
      additional_options=[
        Preference(key="disableTouchEmulation", value=True)
      ]
    ))

    See full example here.

Please note that some preferences may be blacklisted as they may interfere with Kameleo’s spoofing mechanism.

Was this article helpful?

1 out of 1 found this helpful