We recommend that you read the Getting started with Kameleo Automation article before reading this one.
By default, when you create a mobile profile, you should use your mobile device to connect to the external spoofing engine. Automate browsing on the mobile device's browser is not supported yet, but you can set up Kameleo to start the mobile profile on your desktop. The profile will be launched (emulated) in our custom-built Chromium. You can launch these profiles from your code with the Local API and automate browsing with popular automation frameworks.
-
First you need to filter for a Mobile Base Profile
-
const baseProfileList = await client.searchBaseProfiles({ deviceType: 'mobile', osFamily: 'ios', browserProduct: 'safari', language: 'en-us', });
-
var baseProfileList = await client.SearchBaseProfilesAsync( "mobile", "ios", "safari", "en-us" );
-
base_profile_list = client.search_base_profiles( device_type='mobile', os_family='ios', browser_product='safari', language='en-us' )
-
-
You need to set up our custom built chromium as a launcher, so the mobile profile will start on your desktop.
-
const createProfileRequest = BuilderForCreateProfile .forBaseProfile(baseProfileList[0].id) .setRecommendedDefaults() .setLauncher('chromium') .build(); const profile = await client.createProfile({ body: createProfileRequest });
-
var createProfileRequest = BuilderForCreateProfile .ForBaseProfile(baseProfileList[0].Id) .SetRecommendedDefaults() .SetLauncher("chromium") .Build(); var profile = await client.CreateProfileAsync(createProfileRequest);
-
create_profile_request = BuilderForCreateProfile \ .for_base_profile(base_profile_list[0].id) \ .set_recommended_defaults() \ .set_launcher('chromium') \ .build() profile = client.create_profile(body=create_profile_request)
-
-
It is recommended to pass the following additionalOption when you start the profile. This allows you to click on elements using the cursor when emulating a touch screen in the brower. If you leave this out, your script may time out after clicks and fail.
-
await client.startProfileWithOptions(profile.id, { body: { additionalOptions: [ { key: 'disableTouchEmulation', value: true, }, ], }, });
-
await client.StartProfileWithOptionsAsync(profile.Id, new WebDriverSettings() { AdditionalOptions = new List<Preference> { new Preference("disableTouchEmulation", true), } });
-
client.start_profile_with_options(profile.id, body={ 'additionalOptions': [ { 'key': 'disableTouchEmulation', 'value': True, }, ], })
-
If you want to see the full example code, click any of the links below: