I want to fill information such as name, surname, etc. in the empty columns with Selenium according to the student numbers drawn from Excel to DataGridView. However, I'm stuck getting data into empty columns. Is there anyone who can help with this?
var val2 = drv.FindElement(By.Id("txtAdi")).GetAttribute("value");
val2 = dataGridView1.Rows[i].Cells[1].Value.ToString(); // datagridview cell to which I want to assign val2 data. I want to solve this line.

Amit MohantyRank #112 · 20K reputationPosted Jan 4, 2024, 7:27 AM EST
Try this:
dataGridView1.Rows[i].Cells[1].Value = val2;Mehmet FatihRank #1,474 · 1.1K reputationPosted Jan 4, 2024, 8:04 AM EST
Thanks for your intrest, Amit. But I have tried id before. But it doesn't work. I can't assign val2 data to datagrdview.
Amit MohantyRank #112 · 20K reputationPosted Jan 4, 2024, 8:29 AM EST
Are you getting any error, Mehmet? Can you verify that val2 holds the expected data by debugging.
Mehmet FatihRank #1,474 · 1.1K reputationPosted Jan 4, 2024, 9:33 AM EST
No, I am not getting any error. But It doesn't insert val2 value to the datagridview cell.
Mehmet FatihRank #1,474 · 1.1K reputationPosted Jan 4, 2024, 10:56 AM EST
Thank you Amit. Your code works fine. I made a mistake while executing your code. I'm sorry it didn't work well for that reason.