Reading data from excel in selenium C#
问题 I'm trying to read username and password from excel sheet while using Selenium in C# .NET. Below is the code: using excel = Microsoft.Office.Interop.Excel; public void TestMethod1() { excel.Application xlApp = new excel.Application(); excel.Workbook xlWorkbook = xlApp.Workbooks.Open(@"D:\Test\TestData.xlsx"); excel._Worksheet xlWorksheet = **xlWorkbook.Sheets[1];** excel.Range xlRange = xlWorksheet.UsedRange; } I'm getting the following error at the text that is marked in bold in above code: