Webpage redirects to home page.

63 views
Skip to first unread message

Swapneel Shah

unread,
Dec 31, 2025, 9:18:04 AM12/31/25
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,
Dec 31, 2025, 5:29:25 PM12/31/25
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.

Swapneel Shah

unread,
Jan 1, 2026, 8:03:47 PMJan 1
to seleniu...@googlegroups.com
Happy New Year Venkatesh!

Thank you for your response. I will explore your suggestions.

Regards,

You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/aI5tIkco7J0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/selenium-users/CAHqOtnPnk4GBcaHGpNBSXPPfh0EZa2B1G9goxJ%2BogFUVbRYjMg%40mail.gmail.com.


--

Syed Usama

unread,
Jan 2, 2026, 7:09:20 AMJan 2
to seleniu...@googlegroups.com
If you are using selenium python then use 

undetected-chromedrive

 library  and  

selenium-stealth

 library.

Swapneel Shah

unread,
Jan 2, 2026, 7:47:01 AMJan 2
to seleniu...@googlegroups.com
I am using C# and found C# alternatives for this library. I will give it a shot once I am back from the New Year's holiday.

Happy New Year!



--
Reply all
Reply to author
Forward
0 new messages