0

I developed an application using Selenium Chrome Driver in C# which worked reliably for two years. However, a few months ago, the application encountered an issue on a specific page where it couldn't locate any elements anymore. This includes fundamental elements like the tag, elements, or any other element located using various FindBy methods. It's important to note that this issue is isolated to this specific page; other pages such as google.com are still functioning correctly.

I've made several attempts to resolve the issue. I've utilized techniques like WebDriverWait and window switching, but unfortunately, none of these attempts have been successful. Below is a simplified version of the console app code I'm using for testing and investigation and a link to the content returned by driver.PageSource.

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;

var options = new ChromeOptions
{
    AcceptInsecureCertificates = true
};
//options.AddArgument("no-sandbox");
var driver = new ChromeDriver(options);

driver.Navigate().GoToUrl("omitted for security");

var el = driver.FindElements(By.TagName("body")).FirstOrDefault();

while (el == null)
{
    Thread.Sleep(3000);
    Console.WriteLine("Source: " + driver.PageSource);
    el = driver.FindElements(By.TagName("body")).FirstOrDefault();
}

driver.Quit();

page source

  • Not sure which requirements Selenium has but for browsers [you should include a doctype](https://stackoverflow.com/a/6076470/3034273). You might also want to validate your HTML here: https://validator.w3.org/#validate_by_input+with_options – Xerillio Aug 16 '23 at 20:05

0 Answers0