Selenium.WebDriver.UndetectedChromeDriver icon indicating copy to clipboard operation
Selenium.WebDriver.UndetectedChromeDriver copied to clipboard

Bypass cloudfare detection in headless mode

Open Adelgrazy opened this issue 3 years ago • 2 comments

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,

Adelgrazy avatar Jul 20 '22 14:07 Adelgrazy

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.

emre-gon avatar Jul 29 '22 23:07 emre-gon

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/

RifHut avatar Nov 10 '22 23:11 RifHut