openbullet / OpenBullet2

OpenBullet reinvented
https://docs.openbullet.dev/
MIT License
1.8k stars 479 forks source link

[REQUEST]: Improve Multi extraCmdLineArgs Function [demo model] #1107

Open RifHut opened 2 months ago

RifHut commented 2 months ago

This feature request respects the following points:

Description of the feature request

When I work with multiple arguments in Selenium, I get an error because of the double quotes in the arguments. For example: --user-data-dir="C:/Users/Me/AppData/Local/Google/Chrome/User Data" and --load-extension="D:/OB2 0.2.5/OpenBullet2.Native/Extensions/Captchaclik". If you leave the double quotes and use chromeOptions.AddArgument(...), the string gets divided by the quotes, and the argument will not work correctly."

Is your feature request related to a problem

of course yes, check the link in the forum : [https://discourse.openbullet.dev/t/how-to-install-multiple-extension-in-puppeter-or-selenium/7035/3](Read more..)

Describe the solution you'd like

so to improve this logic please check my repository https://github.com/RifHut/OpenBullet2/blob/0355ee34a754ac6e753c2ed9877d257248499570/RuriLib/Blocks/Selenium/Browser/Methods.cs#L95

the code like this :


// This regex will split the string by "|" unless the space is within quotes.
                        // Case of Multipe Arguments in extraCmdLineArgs in OpenBrowser Using Selenium Ex: arg1|arg2|arg3...
                        var argsArray = Regex.Matches(args, @"[^|]+")
                                                 .Cast<Match>()
                                             .Select(m => m).ToList();
                       foreach (var match in argsArray) { 
                       // Add the command line arguments to chrome options.
                       chromeop.AddArguments(match.ToString());
                       }`

Describe alternatives you've considered

BLOCK:SeleniumOpenBrowser
  extraCmdLineArgs = $"|--start-maximized |<EXTRARG>|--user-agent=<UAA>|--user-data-dir=C:\\PROFILES\\DATADIR\\BROWSERSDIR\\<input.EMAIL>"
ENDBLOCK

The pipe | separates multiple arguments in chromeOptions.AddArguments using the pipe separator.

Relevant screenshots or videos

No response

Additional information

No response