Skip to content

Commit f12c485

Browse files
committed
~ update readme
1 parent afa126f commit f12c485

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,42 @@ await page.GotoAsync("https://google.com");
178178

179179
The full example can be found [here](https://github.com/kameleo-io/local-api-examples/blob/master/dotnet-csharp/connect_with_playwright_to_firefox/Program.cs).
180180

181+
# Automate mobile profiles
182+
Kameleo can emulate mobile devices in the custom built Chromium.
183+
184+
```csharp
185+
var baseProfileList = await client.SearchBaseProfilesAsync(
186+
"mobile",
187+
"ios",
188+
"safari",
189+
"en-us");
190+
191+
// Create a new profile with recommended settings
192+
// Choose one of the Base Profiles
193+
// Set the launcher to 'chromium' so the mobile profile will be started in Chromium by Kameleo
194+
var createProfileRequest = BuilderForCreateProfile
195+
.ForBaseProfile(baseProfileList[0].Id)
196+
.SetRecommendedDefaults()
197+
.SetLauncher("chromium")
198+
.Build();
199+
200+
var profile = await client.CreateProfileAsync(createProfileRequest);
201+
202+
// Start the profile with a couple of extra parameters, so Selenium automation can be done fluently
203+
await client.StartProfileWithWebDriverSettingsAsync(profile.Id, new WebDriverSettings()
204+
{
205+
AdditionalOptions = new List<Preference>
206+
{
207+
// This allows you to click on elements using the cursor when emulating a touch screen in the brower.
208+
// If you leave this out, your script may time out after clicks and fail.
209+
new Preference("disableTouchEmulation", true),
210+
}
211+
});
212+
213+
// At this point you can automate the browser with your favorite framework
214+
```
215+
The full example can be found [here](https://github.com/kameleo-io/local-api-examples/blob/master/dotnet-csharp/automate_mobile_profiles_on_desktop/Program.cs).
216+
181217
# Example codes
182218
[Several examples](https://github.com/kameleo-io/local-api-examples) have been prepared in a different repository to showcase the most interesting features. Feel free to create a pull request to add new example codes.
183219

@@ -188,10 +224,14 @@ The full example can be found [here](https://github.com/kameleo-io/local-api-exa
188224
- Using Selenium with Local API
189225
- Using Playwright with Kameleo
190226
- Using Puppeteer with Kameleo
227+
- How to emulate mobile devices
191228
- Adding an HTTP, SOCKS or SSH proxy to profile
192229
- Saving/Loading a browsing session to/from a .kameleo file
193230
- Modify and Delete browser cookies
194231
- Start profile with extra WebDriver capabilities
232+
- How to duplicate virtual browser profiles
233+
- Test proxies
234+
- Refresh the browser of the emulated profiles
195235

196236
> Note: _If you are interested in more information about Kameleo, or have encountered an issue with using it, please check out our [Help Center](https://help.kameleo.io/)._
197237

0 commit comments

Comments
 (0)