emre-gon / Selenium.WebDriver.UndetectedChromeDriver

GNU General Public License v3.0
62 stars 18 forks source link

Bypass cloudfare detection in headless mode #8

Open Adelgrazy opened 2 years ago

Adelgrazy commented 2 years ago

Hello.

I was trying to use this library to bypass CloudFare detection. When I tried to use driver in normal mode everything is OK, but then I pass headless flag I got an error in FindElement after 60sec timeout

Here is my code snippet:

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using Selenium.WebDriver.UndetectedChromeDriver;

using (var driver = UndetectedChromeDriver.Instance("Пользователь 1", true))
{
    driver.GoTo("https://nowsecure.nl");
    driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(180);
    driver.FindElement(By.XPath(@"/html/body/div[2]/div/main/p[2]/a"));
}
Console.ReadKey();

Chrome version: 103.0.5060.134

And error: image

Maybe you have some ideas how to bypass cloudfare in headless mode?

Thanks in advance,

emre-gon commented 2 years ago

Headless issue is also being discussed here: https://github.com/ultrafunkamsterdam/undetected-chromedriver/issues/589

It will always be problematic as there are many tricks to detect headless browsing. I don't have unique ideas.

RifHut commented 1 year ago

try using this args // chromeop.AddArgument("--window-size=1920,1080"); // chromeop.AddArgument("--start-maximized"); // chromeop.AddArgument("--no-sandbox"); or try with cdp cmd to change some values in navigator

to check if you are 100% headfull ! check with this awesome filter https://infosimples.github.io/detect-headless/