Avoid bot detection not working with Selenium

+1 vote

I am accessing this website using a selenium chrome web driver, but whenever I submit the form it asks for me to verify that am not a bot. I have tried the following links (1, 2, 3) about avoiding detection but none of them worked.

     public void AvoidDetectionChrome(){
        System.setProperty("webdriver.chrome.driver", "path\\chromedriver.exe");

        //Set ChromeOptions
        ChromeOptions options = new ChromeOptions();
        options.addArguments("start-maximized");
        options.addArguments("--disable-blink-features=AutomationControlled");
        options.setExperimentalOption("excludeSwitches", new String[]{"enable-automation"});
        //Instantiate Web Driver
        WebDriver driver = new ChromeDriver(options);
        driver.get("https://www.americanairlines.ie/intl/ie/index.jsp");
    }

and code for Firefox driver:

public void AvoidDetectionFirefox(){
        System.setProperty("webdriver.gecko.driver", "path\\geckodriver.exe");

        //Set Firefox options
        FirefoxOptions options = new FirefoxOptions();
        options.addPreference("network.proxy.type", 1);
        options.addPreference("network.proxy.http", "localhost");
        options.addPreference("network.proxy.http_port", "3128");
        options.addPreference("dom.webdriver.enabled", false);
        options.setHeadless(false);

        //Instantiate Web Driver
        WebDriver driver = new FirefoxDriver(options);
        driver.manage().window().maximize();

        String url = "https://www.americanairlines.ie/intl/ie/index.jsp";
        driver.get(url);
    }

Both of them fail to avoid the bot detection and I get asked confirmation once I click the submit button, as could be seen in the image below: 

error-message

So how can I make any of the methods work when I submit the form and avoid the bot verification/detection?

Jul 28, 2020 in Selenium by laiman
• 330 points
22,542 views

1 answer to this question.

0 votes

Looks like the website is protected by Bot Management service provider Distil Networks and the navigation by ChromeDriver gets detected and subsequently blocked. Distil is like a bot firewall.

For more info refer to 

Try removing the cdc_ portion from chromedriver.

For further understanding, you can refer to the Selenium Training.

Hope this helps!

answered Jul 28, 2020 by Kim

Hi, thank you for your answer. The links you wrote and other threads like this suggest that I edit the chromedriver.exe and change variable name cdc_ to something else. But I have no idea how to do that or go about it?

All you have to do is open binary(chromedriver.exe) in hex editor, change string starting with $cdc to some other string of same length, then save and run modified binary.
Hi, I was able to edit it and it actually worked for a couple of requests and then started failing again. Using vpn to change my ip did not work either. Not sure what to do now. But thanks for the help and suggestions.
Try to maximize the browser window (rather than use a predefined size) it's detected less often. Hope this helps!

Related Questions In Selenium

0 votes
1 answer

Selenium IDE (2.9.1.1-signed) not working with latest Version of Firefox

Unfortunately, Selenium IDE will be deprecated soon. ...READ MORE

answered Mar 30, 2018 in Selenium by nsv999
• 5,500 points

edited Apr 4, 2018 by nsv999 7,199 views
0 votes
1 answer

Selenium + Java - drag and drop not working on selenium 3.8

How about you try adding the below ...READ MORE

answered Mar 28, 2018 in Selenium by nsv999
• 5,500 points
4,743 views
+2 votes
4 answers

sendKeys() not working in Selenium Webdriver

this work for me you should update your ...READ MORE

answered Aug 27, 2019 in Selenium by Afif
29,470 views
0 votes
1 answer

findElement(By.xpath()) not working using Selenium WebDriver

element = findElement(By.xpath("//*[@test-id='test-username']"); element = findElement(By.xpath("//input[@test-id='test-username']"); (*) - any ...READ MORE

answered Apr 18, 2018 in Selenium by code_ninja
• 6,290 points
8,785 views
0 votes
1 answer

Error: FF Browser not working for Selenium test after update

Since Firefox's latest update to version 47.0, ...READ MORE

answered Apr 21, 2018 in Selenium by king_kenny
• 3,710 points
1,144 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
12,718 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
8,612 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
6,685 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,554 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP