Mehmet Fatih

Mehmet Fatih

  • 857
  • 939
  • 41k

Filling datagrdiview cell from website with selenium

Dec 25 2023 6:57 AM

I am using Windows form with c# language.  I want to retrieve data from website. I want to fill in the empty cells in the datagridview in the line in front of the numbers of the people whose numbers I pulled from Excel. I am trying the following codes but I am getting the error “System.InvalidOperationException: 'Denetim veriye bagli oldugunda DataGridView'in satirlar koleksiyonuna satirlar program araciligiyla eklenemez”

var val1 = dataGridView1.Rows[i].Cells[1].Value.ToString();
var val2 = dataGridView1.Rows[i].Cells[2].Value.ToString();
val1 = drv.FindElement(By.Id("name")).Text;
val2 = drv.FindElement(By.Id("surname")).Text;
dataGridView1.Rows.Add(val1);
dataGridView1.Rows.Add(val2);


Answers (2)