Rust-undetected-chromedriver icon indicating copy to clipboard operation
Rust-undetected-chromedriver copied to clipboard

not passing Coudflare Turnstile

Open chungwong opened this issue 2 years ago • 9 comments

It is detected with chrome 116.0.5845.110 It looks like https://github.com/ultrafunkamsterdam is having the same issue too.

use undetected_chromedriver::chrome;
use tokio;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let driver = chrome().await?;

    driver.goto("https://nowsecure.nl/").await?;

    let title = driver.title().await?;
    println!("Title: {}", title);

    // driver.quit().await?;

    Ok(())
}

chungwong avatar Oct 03 '23 04:10 chungwong

Hey, thanks for submitting an issue. It does look like the newer Chrome versions are indeed being detected sometimes. I did some quick experiments, and it seems like when going to the site through a new tab, it passes without any issues. I have no idea why thought. I will do some further investigations and come up with a fix soon.

Ulyssedev avatar Oct 03 '23 18:10 Ulyssedev

I confirm the behaviour on manually opening a new tab, however, if the new tab is part of the automation, it will still fail.

use undetected_chromedriver::chrome;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let driver = chrome().await?;

    driver.goto("https://google.com/").await?;
    let handle = driver.new_tab().await?;
    driver.switch_to_window(handle).await?;
    tokio::time::sleep(std::time::Duration::from_secs(1));
    driver.goto("https://nowsecure.nl/").await?;

    tokio::time::sleep(std::time::Duration::from_secs(100));

    Ok(())
}

chungwong avatar Oct 06 '23 00:10 chungwong

I confirm the behaviour on manually opening a new tab, however, if the new tab is part of the automation, it will still fail.


use undetected_chromedriver::chrome;



#[tokio::main]

async fn main() -> Result<(), Box<dyn std::error::Error>> {

    let driver = chrome().await?;



    driver.goto("https://google.com/").await?;

    let handle = driver.new_tab().await?;

    driver.switch_to_window(handle).await?;

    tokio::time::sleep(std::time::Duration::from_secs(1));

    driver.goto("https://nowsecure.nl/").await?;



    tokio::time::sleep(std::time::Duration::from_secs(100));



    Ok(())

}

yes,you have to perform specific steps to bypass cloudflare. I will be releasing a video on my channel shortly showing how to bypass it using rust and this crate :)

itehax avatar Oct 17 '23 06:10 itehax

https://github.com/itehax/rust-scraping

you can find a way to bypass cloudflare using this library in this project.

itehax avatar Oct 26 '23 09:10 itehax

The latest commit has made it possible to bypass cloudflare, code improvements are still needed and further testing must be done until it can be released properly. This is still a work in progress and will introduce some breaking changes. This would have not been possible without the work of @itehax, so thanks a lot!

Ulyssedev avatar Oct 26 '23 13:10 Ulyssedev

Silly question, but how does this differ from what the guys over at https://github.com/kaliiiiiiiiii/Selenium-Driverless are doing, according to what i've read they managed to get around the more recent detections?

cchance27 avatar Mar 22 '24 19:03 cchance27

Silly question, but how does this differ from what the guys over at https://github.com/kaliiiiiiiiii/Selenium-Driverless are doing, according to what i've read they managed to get around the more recent detections?

Thee key here is Runtime.enable detection. Also see https://github.com/kaliiiiiiiiii/Selenium-Driverless/discussions/86#discussion-5717720 and https://github.com/HMaker/HMaker.github.io/tree/master/selenium-detector

kaliiiiiiiiii avatar Apr 28 '24 07:04 kaliiiiiiiiii

I guess I would have to rewrite the library without thirtyfour to create something similar to https://github.com/ultrafunkamsterdam/nodriver

Ulyssedev avatar Apr 28 '24 09:04 Ulyssedev

I guess I would have to rewrite the library without thirtyfour to create something similar to https://github.com/ultrafunkamsterdam/nodriver

basically, you've got to use the CDP protocol directly. Lot of work I can tell - from experience at driverless :/

kaliiiiiiiiii avatar Apr 28 '24 09:04 kaliiiiiiiiii