So we are validating the text present in our site using the excel sheet.
for(int i = 0; i < services.Count; i++)
{
string ServiceName = ExcelFunction.getCellValue(filepath, TestContext.CurrentContext.Test.MethodName, "ServiceName", i);
ILocator service17 = page.Locator("//span[text()=ServiceName]");// here I want to append the ServiceName that I get from excel sheet to the selector.
}
Is there any way to append the variables in selectors in C#?
This should do it:
ILocator service17 = page.Locator("//span[text()=ServiceName" + ServiceName + "]");