Comments (4)
` bool HL = (data.GlobalSettings.Selenium.Headless || data.ConfigSettings.ForceHeadless);
bool PATCHER = data.ConfigSettings.EnableUndetectChromeDriver;
/* Profile data string of the given path */
string PATH = data.ConfigSettings.ProfilePath + @"";
Match PROFILE = Regex.Match(data.Data.Data, @"([\w.-]+@[\w.-]+)");
string full_path = PATH + PROFILE;
data.Log(new LogEntry("Opening browser...", Colors.White));
string ProfileName = "";
switch (data.GlobalSettings.Selenium.Browser)
{
case BrowserType.Chrome:
try
{
UndetectedChromeDriver.ENABLE_PATCHER = PATCHER; //True or False
ChromeDriverParameters chromeDriverParameters = new ChromeDriverParameters();
ChromeOptions chromeop = new ChromeOptions();
chromeop.BinaryLocation = data.GlobalSettings.Selenium.ChromeBinaryLocation;
chromeDriverParameters.Timeout = new TimeSpan(0, 0, 22);
//chromeDriverParameters.DriverArguments = Args;
//chromeDriverParameters.ExcludedArguments = Exc;
//chromeDriverParameters.Headless = HL; //True or False
if (data.ConfigSettings.DefaultProfileDirectory == false)
{
ProfileName = chromeDriverParameters.ProfileName = full_path;
//chromeop.AddArgument("user-data-dir=" + full_path);
if (!Directory.Exists(full_path))
{
Directory.CreateDirectory(full_path);
}
data.Log(new LogEntry($"Browser DATAPATH : {full_path} and his profile : {data.Data.Data}", Colors.White));
}
if (data.ConfigSettings.DefaultProfileDirectory == true) {
ProfileName = chromeDriverParameters.ProfileName = full_path + "\\Default";
}
if (data.UseProxies) chromeop.AddArgument("--proxy-server=" + data.Proxy.Type.ToString().ToLower() + "://" + data.Proxy.Proxy);
if (!chromeop.Arguments.Any(it => it.Contains("--lang")))
{
var language = CultureInfo.CurrentCulture.Name;
chromeop.AddArgument($"--lang={language}");
data.Log(new LogEntry($"Testing this argument --lang={language}", Colors.White));
}
if (data.ConfigSettings.RandomUA) chromeop.AddArgument("--user-agent=" + UserAgent.Random(data.random));
else if (data.ConfigSettings.CustomUserAgent != string.Empty) chromeop.AddArgument("--user-agent=" + data.ConfigSettings.CustomUserAgent);
if (data.ConfigSettings.CustomCMDArgs != string.Empty) chromeop.AddArgument(data.ConfigSettings.CustomCMDArgs);
if (data.ConfigSettings.CMDArgs != string.Empty) chromeop.AddArgument(data.ConfigSettings.CMDArgs);
try
{
data.Driver = UndetectedChromeDriver.Instance(ProfileName, chromeop, chromeDriverParameters.Timeout);
}
catch
{
break;
}`
Try this Work Fine :) !
@duongbinh214
from selenium.webdriver.undetectedchromedriver.
#15 (comment) l've the asked the same question before
from selenium.webdriver.undetectedchromedriver.
how to use ChromeOptions options = new ChromeOptions(); options.BinaryLocation = pathChromes;
Thanks !!!!!!!!!!!!!!!!!!!
Try this at the end to call the object "options"
There are two options just check the source :
public static SlDriver Instance(string ProfileName, ChromeOptions ChromeOptions)
from selenium.webdriver.undetectedchromedriver.
from selenium.webdriver.undetectedchromedriver.
Related Issues (20)
- [HELP] : I want to use this plugin in open source project. HOT 1
- Run UndetectedChromeDriver with options HOT 3
- How do I get the DevToolsSession?
- userDataDir HOT 8
- Chrome 108 version HOT 3
- [HELP]: can i work with custom browser version and custom chromedriver version ? HOT 1
- [BUG] : undetected_chromedriver.exe window still shown in framework .NET 4.8 (referenced to #5) HOT 6
- How to start using? HOT 2
- Update? HOT 3
- Error with --log-level HOT 1
- Geolocation
- Duplicate window when remote debugging
- Does this package support RemoteWebDriver or Selenium Grid Support
- How to disable password_manager
- ChromeDriver is assuming that Chrome has crashed HOT 3
- Current browser version is 116.0.5845.111 not supported HOT 4
- Couldn’t sign you in This browser or app may not be secure. Learn more Try using a different browser. If you’re already using a supported browser, you can try again to sign in. HOT 4
- Bypass cloudfare detection in headless mode HOT 2
- selenium timed out after 60 seconds. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from selenium.webdriver.undetectedchromedriver.