Bypass cloudfare detection in headless mode
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:

Maybe you have some ideas how to bypass cloudfare in headless mode?
Thanks in advance,
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.
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/