Webpage redirects to home page.

12 views
Skip to first unread message

Swapneel Shah

unread,
9:18 AM (12 hours ago) 9:18 AM
to Selenium Users
Dear Community,

The webpage https://gailgas.com/products/cng redirects to home page without any content when opened using ChromeDriver chDriver.

I have used all recommended options that Github Copilot suggested (and those that made sense). Also, tried a few other options and combinations as well.

Webpage:  https://gailgas.com/products/cng
Code:
            ChromeOptions options = new ChromeOptions();
            options.PageLoadStrategy = PageLoadStrategy.Normal;

            // Headful with desktop viewport
            options.AddArgument("--start-maximized");
            options.AddArgument("--window-size=1920,1080");

            // Reduce automation fingerprints
            options.AddArgument("--disable-blink-features=AutomationControlled");
            options.AddExcludedArgument("enable-automation");
            options.AddAdditionalOption("useAutomationExtension", false);

            // Realistic UA (update to match your Chrome)
            options.AddArgument("--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
                + "(KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36");
            options.AddArgument("--lang=en-US");

            ChromeDriver chDriver = new ChromeDriver(options);
            chDriver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(60);
            chDriver.Manage().Timeouts().AsynchronousJavaScript = TimeSpan.FromSeconds(30);

            chDriver.Manage().Window.Maximize();

            var js = (IJavaScriptExecutor)chDriver;
            js.ExecuteScript("Object.defineProperty(navigator, 'webdriver', {get: () => undefined});");
            js.ExecuteScript("window.chrome = window.chrome || {}; window.chrome.app = {isInstalled: false};");
            js.ExecuteScript("Object.defineProperty(navigator, 'plugins', {get: () => [1,2,3]});");
            js.ExecuteScript("Object.defineProperty(navigator, 'languages', {get: () => ['en-US','en']});");

            chDriver.Navigate().GoToUrl(https://gailgas.com/products/cng);

Can someone please help? Thank you in advance!

Regards

venkatesh iyengar

unread,
5:29 PM (4 hours ago) 5:29 PM
to seleniu...@googlegroups.com
Happy New Year Swapneel,

Please find the cause of the problem  you are facing .

The https://gailgas.com/products/cng page is protected by bot/automation detection. When Selenium/ChromeDriver is detected, the site redirects to the home page without content. This isn’t a bug in your code—it’s the site actively blocking automated browsers. To handle it, you need to bypass detection or use alternative approaches like API calls, headless browser stealth libraries, or tools beyond Selenium.


Regards,

Venkatesh


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/selenium-users/676fea73-6822-4ef4-8666-60fe97ca696dn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages