Mehmet Fatih

Mehmet Fatih

  • 857
  • 931
  • 39.8k

Pulling dropdown elements into datagridview rows

Jan 17 2024 9:18 AM

I am pulling the dropdown elements into the datagridview with Selenium, but all the drawn elements are displayed in a single cell. How can I pull all the elements one by one in the rows of the same column?

IList<IWebElement> options = drv.FindElements(By.Id("dersler")); // tüm dropdown listesini veriri 
foreach (IWebElement option in options)
{
    for (int i = 0; i < options.Count; i++)
    {
            dataGridView1.Rows[0].Cells[1].Value = option.Text.ToString();
        }
    }


Answers (7)