Mehmet Fatih

Mehmet Fatih

  • 857
  • 931
  • 39.5k

Transferring data with selenium based on a criterion in the region

Jan 15 2024 8:35 PM

I transfer student grades in Datagridview to the web page with Selenium. However, when the student order on the web page and the student order in the datagridview are different, each student's grade is transferred differently because the grades are transferred sequentially. How can I transfer grades according to student number, using student number as a criterion?


for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
{
    try
    {
        var val0 = dataGridView1.Rows[i].Cells[0].Value?.ToString();// Ö.NO

        if (val0 != null && val0 != string.Empty)
        {

                var yaz1 = dataGridView1.Rows[i].Cells[3].Value.ToString();
                IWebElement element = drv.FindElement(By.Id("grade1" + (i)))  
               element.Clear();
               element.SendKeys(yaz1);            

        }
    }

    catch (NoSuchElementException)
    {
        continue;

    }

}

 


Answers (5)