Open Joshua901 opened 3 years ago
First, you have to understand how Kameleo is working with Selenium. I'll describe it for you:
RemoteWebDriver
is not starting any browser, just connecting to the already stated browser
Because of these, you cannot pass any arguments to the browser with the RemoteWebDriver
's options.However there is a solution how you can provide additional web driver options. There is a POST /profiles/{guid}/start
endpoint. See its documentation on SwaggerHub. The GET /profiles/{guid}/start
endpoint is simply starting the profile, but this POST /profiles/{guid}/start
endpoint can process additional arguments, options, and preferences.
See our example code.
await client.StartProfileWithWebDriverSettingsAsync(profile.Id, new WebDriverSettings
{
Arguments = new List<string> { "mute-audio" },
Preferences = new List<Preference>
{
new Preference("profile.managed_default_content_settings.images", 2),
new Preference("profile.password_manager_enabled.images", 2),
},
AdditionalOptions = new List<Preference>
{
new Preference("pageLoadStrategy", "eager"),
}
});
Please note that there are arguments we are not supporting, as that may cause issues and it may stop our spoofing mechanism to work.
I see that you use this flag:
opts.AddArgument("--disable-extensions");
This is cannot be added, since the built-in browsers are preinstalled with Kameleo's extension. If you remove it, the spoofing won't work.
I see you want to use this flag as well:
opts.AddArgument("disable-gpu");
You can simply set WebGL to Block with this call:
.SetWebgl("block")
It will result in the "disable-3d-apis" flag
Using an incognito window is not necessary. The spoofing is working in the regular mode (not incognito), and it won't be suspicious for websites. Please note that the spoofing in the incognito mode is not working yet.
Currently, there is no opportunity to start the browser in headless mode. But this is something we will support in the future. What other WebDriver configs are must-haves for you?
Been testing now whole day. Noticed something strange.
I want to add my additional ChromeOptions to my driver, especially be able to run things in "headless" mode. Even if i define the Chromeoptions above and create the RemoteWebDriver with these options, the chrome browser does still popup and not run as headless. How come and how do i add my additional options?