I want to customize more parameters, is it possible?
Opened this issue · 5 comments
vudonblog commented
Hello
I want to edit more Screen, Timezone,Language,Geo Location is it possible and where to replace the parameters
hope you help
fysh711426 commented
I released a alpha package, you can try it.
PM> Install-Package Selenium.UndetectedChromeDriver -Version 1.0.6-alpha
// Set screen.
options.AddArguments("--window-size=1920,1080");
options.AddArguments("--start-maximized");
// Set language.
options.AddArguments("--lang=en");
// Set enable geolocation.
var prefs = new Dictionary<string, object>
{
["profile.default_content_setting_values.geolocation"] = 1
};
// using keyword is required to dispose the chrome driver
using var driver = UndetectedChromeDriver.Create(
options: options,
driverExecutablePath: driverExecutablePath,
prefs: prefs);
// Set timezone.
driver.ExecuteCdpCommand(
"Emulation.setTimezoneOverride",
new Dictionary<string, object>
{
["timezoneId"] = "America/New_York"
});
// Set geolocation.
driver.ExecuteCdpCommand(
"Emulation.setGeolocationOverride",
new Dictionary<string, object>
{
["latitude"] = 42.1408845,
["longitude"] = -72.5033907,
["accuracy"] = 100
});
driver.GoToUrl("https://nowsecure.nl");
vudonblog commented
thank you. Overly supportive
vudonblog commented
i tried and got error setGeolocationOverride
2 values of latitude and longitude are not correct, checkiphey it is taken by ip
if possible can you please tell me how to edit WebGL WebRTC, City and zipcode on Location
thank you very much
fysh711426 commented
fysh711426 commented
// Disable WebGL.
options.AddArgument("--disable-gpu");
options.AddArgument("--disable-software-rasterizer");
// Test
driver.GoToUrl("https://bot.sannysoft.com/");
// Disable WebRTC.
var prefs = new Dictionary<string, object>
{
["webrtc.ip_handling_policy"] = "disable_non_proxied_udp",
["webrtc.multiple_routes_enabled"] = false,
["webrtc.nonproxied_udp_enabled"] = false
};
using var driver = UndetectedChromeDriverCreate(
...
prefs: prefs);
// Test
driver.GoToUrl("https://browserleaks.com/ip");
City and zipcode I didn't find a way to change.