The value mentioned in the Excel file is 21.650 and same value is presented on the page. But when script executes, it reads Excel value as 21.65 and my assert condition becomes false.
List<string> rowValue = new List<string> { };
var ExcelFilePath = "D:\\testexcel.xlsx";
Excel.Application xlApp = new Excel.Application(ExcelFilePath);
Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(ExcelFilePath);
Excel._Worksheet xlWorksheet = xlWorkbook.Sheets[1];
Excel.Range xlRange = xlWorksheet.UsedRange;
int rowCount = xlRange.Rows.Count;
for (int i = 1; i <= rowCount; i++)
{
rowValue.Add(xlRange.Cells[i, j].Value2.ToString());
IWebElement element = driver.FindElement(By.Id(weight_field));
((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].scrollIntoView(true);", element);
string weight = driver.FindElement(By.Id(weight_field)).Text;
if (mpuid == i)
{
Assert.AreEqual(weight,rowValue[0]);
Console.WriteLine(" Expected Value: " + rowValue[0] + " is equal to Actual Value: " + weight);
break;
}
rowValue.Clear();
}