fysh711426 / UndetectedChromeDriver

GNU General Public License v3.0
166 stars 61 forks source link

Linux \debian support #7

Open thenik opened 2 years ago

thenik commented 2 years ago

Hey!

Does it work with linux \ debian ?

Thanks!

fysh711426 commented 2 years ago

Only tested on windows. But, except that you need to set the browserExecutablePath by yourself, other functions maby can work normally. If you have problems using it, I will try to fix it.

fysh711426 commented 2 years ago
PM> Install-Package Selenium.UndetectedChromeDriver -Version 1.0.5-alpha

I released a alpha package with some code to support linux or macos, you can try it.

thenik commented 2 years ago

thanks, I tried your 1.0.5-alpha. andit does not work on Linux\ Debian

how to reproduce

// step 1 via Atata Idownload driver var driverSetupResults = DriverSetup.AutoSetUp(BrowserNames.Chrome); Log("driverSetupResults:" + driverSetupResults.DirectoryPath);

        _driverPath = Path.Combine(driverSetupResults.DirectoryPath, driverSetupResults.FileName);

//step 2 patch

var p = new SeleniumUndetectedChromeDriver.Patcher(_driverPath); p.Auto();

//step 3

_uDriver.Navigate().GoToUrl(u); //it crashes onLinux and it works on windows

Exception: unknown error: net::ERR_CONNECTION_RESET (Session info: chrome=102.0.5005.61) [2022-06-16 10:15:12] at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse)

image

fysh711426 commented 2 years ago

I tested the code with a VirtualBox, but the results are confusing. The code is executed successfully, but the chrome screen is stuck and keeps flashing. (Debian and Ubuntu are like this)

var driverExecutablePath = $@"/home/aaa/chromedriver/chromedriver";

var options = new ChromeOptions(); 
options.AddArgument("--no-sandbox");
options.AddArgument("--mute-audio");
options.AddArgument("--disable-gpu");
options.AddArgument("--disable-dev-shm-usage");

using var driver = UndetectedChromeDriver.Create(
    options: options,
    driverExecutablePath: driverExecutablePath);

driver.GoToUrl("https://nowsecure.nl");

Console.ReadLine();

1655508786268

fysh711426 commented 2 years ago

Try replacing this.

_uDriver.Navigate().GoToUrl(u);

to

_uDriver.GoToUrl(u);
D3FALT404 commented 1 year ago

doesn't work for me either sadly i am using rasberry pi4

D3FALT404 commented 1 year ago
        public WebDriver()
        {
            ChromeDriverInitize();
        }

        protected void ChromeDriverInitize()
        {
            var options = new ChromeOptions();
            options.AddArgument("--disable-dev-shm-usage");

            webDriver = UndetectedChromeDriver.Create(options: options,headless: true,
             driverExecutablePath: @"/usr/bin/chromedriver");

            addCookies();
        }

        public void GoToSteam(string key)
        {
            Console.WriteLine(key);
            GoToUrl($"https://store.steampowered.com/account/registerkey?key={key}");
            Click("//*[@id=\"accept_ssa\"]");
            Click("//*[@id=\"register_btn\"]/span");
            Dispose();
        }

        public void GoToUrl(string url)
        {
            webDriver.GoToUrl(url);
    }