M
M
Michael Reed2019-03-05 10:48:53
C++ / C#
Michael Reed, 2019-03-05 10:48:53

Generic class for working with tables on a page?

Hello,
I need to write a generic class (C#) that would work with any table on the site (on the page).
So that you can take, for example, by the name of the table, pull data from it and see
if the username is present and if "yes", then press some button "delete",
"edit", click the checkbox in this line (in which there are data about the user.)
Page:
5c7e297d8a460082231612.png
code snippet:
5c7e298d27069065746861.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Eremin, 2019-03-05
@EreminD

So
what doesn't work? Let's get the code

M
Michael Reed, 2019-03-05
@ahmshere

I write a simple class:
class DelegationData
{
public string StartDate { get; set; }
public string EndDate { get; set; }
public string Delegate { get; set; }
public bool Edit { get; set; }
public bool Delete { get; set; }
}
Then in the main page class I write:
...
public List GetTableData()
{
var listOfAllProcesses = new List();
try
{
List listOfProcesses = GetListOfTable();
foreach (var item in listOfProcesses)
{
listOfAllProcesses.Add(new DelegationData()
{
StartDate = item.FindElement(By.XPath("//*[@class='text']")).Text,
EndDate = item.FindElement(By.XPath("// *[@class='description']")).Text,
Delegatee = item.FindElement(By.ClassName("")).Text,
Edit = IsEditButtonExists(item),
Delete = IsDeleteButtonExists(item)
});
}
return listOfAllProcesses;
}
catch (Exception ex)
{
throw new Exception($"Could not get data. Error: {ex.Message}");
}
}
...
But it throws an error: Inconsistent accessibility: return type'List' is less accessible than method 'DelegationData.GetTableData()'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question