I am trying to download csv files from https://www.ffiec.gov/npw/Institution/Profile/1132449 using selenium web driver. Below is my code snippet
public static void Main()
{
//Console.Write("Please enter RSSD ID :");
//var rssdId = Console.ReadLine();
var URL = "https://www.ffiec.gov/npw/Institution/Profile/1132449";// + rssdId;
IWebDriver driver = new ChromeDriver();
driver.Navigate().GoToUrl(URL);
List<string[]> items = new List<string[]>();
var divy9crow = driver.FindElement(By.Id("y9crow"));
divy9crow.FindElement(By.TagName("button")).Click();
int milliseconds = 2000;
Thread.Sleep(milliseconds);
var divFRY9C = divy9crow.FindElement(By.Id("FRY9C"));
milliseconds = 3000;
IReadOnlyCollection<IWebElement> divYears = divFRY9C.FindElements(By.ClassName("col-sm-2"));
foreach (IWebElement divYear in divYears)
{
var ulElements = divYear.FindElements(By.TagName("ul"));
foreach (IWebElement ulElement in ulElements)
{
var spanElement = ulElement.FindElement(By.ClassName("fin-report-images"));
var aTags = spanElement.FindElements(By.TagName("a"));
aTags[0].Click();
Thread.Sleep(milliseconds);
//spanElement.FindElement(By.XPath("//a[contains(.,'ReturnFinancialReportCSV')]")).Click();
//spanElement.FindElement(By.ta("ReturnFinancialReportCSV")).SendKeys(Keys.Enter);
}
}
driver.Quit();
}
when I download the files manually its not asking for verify human but when try to download using code its asking for human verification (please see below image). how to avoid this?
Is there any better way of writing code for downloading the files??