I have this table and I want to verify files have been uploaded successfully
I want to iterate through the first column and add file names to a list to assert against an expected list
This works but I am wondering how I can modify my method to be able to iterate through all columns and rows and I can add any column to the list. Basically make the method more useable and not use it just to verify file names but also to be able to verify other columns if needed
public List<string> ListofFilesUploaded()
{
IWebElement table = WebDriver.Driver.FindElement(By.XPath("//table[@id='files_list']//tbody"));
IList<IWebElement> rows = table.FindElements(By.TagName("tr"));
List<string> fileNames = new List<string>();
foreach (var row in rows)
{
fileNames.Add(row.Text.Split(' ').First());
}
return fileNames;
}
Does anyone have an idea how to enhance this solution or improve this?