I have 3 classes , First class in which we write methods, second we call the methods, third in which we use it for our execution.
In the First Class i have written below c# code to retrieve all the row text in webpage through selenium.
public void GetUsedChecklistRecords()
{
SelectElement records = new SelectElement(reportsDr.FindElement(By.XPath("//div[contains(text(),'Benefit Checklist')]")));
IList<IWebElement> options = records.Options;
foreach(IWebElement option in options)
{
System.Console.WriteLine(option.Text);
}
}
I am confused how to call it in second class and then use it in third class which looks as below
public void ChecklistUsedReportsTest()
{
reportsPage.SelectRE("Reporting Entity 02");
List<String> WorkPaperName = new List<String>(new String[] {"Entertainment","Loan" });
List<String> reportName = new List<string>(new String[] {"Entertainment Benefit Checklist","Loan Benefit Checklist"});
for (int a = 0; a < WorkPaperName.Count; a++)
{
reportsPage.NavigateToChecklist(WorkPaperName[a]);
var ActualRecords= reportsPage.GetUsedChecklistRecords();
List<string> difference = ActualRecords.Except(reportName).ToList();
foreach (var value in difference)
{
Console.WriteLine(value);
}
Console.ReadLine();
Assert.AreEqual(reportName,ActualRecords);
}}
It's not working, please help how to proceed. because the method in the first class is void then it should be called as void only in second class, but then how should i use it to compare in third class