Mehmet Fatih

Mehmet Fatih

  • 804
  • 923
  • 31.9k

Getting data based on Val1 value with Selenium

Jan 4 2024 5:33 PM

I want to pull the following data into each row one by one according to the val1 value that changes each time. Column 1 contains val1 values. I enter column1 values manually. I want to fill the rows with data by searching with selenium in each row according to these entered val1 values. But my code pulls the first val1 value to each line. My codes are as follows.

               for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
              var val1 = dataGridView1.Rows[i].Cells[0].Value.ToString();//Student’s number
                var val2 = drv.FindElement(By.Id("txtAdi")).GetAttribute("value"); // adi
                var val3 = drv.FindElement(By.Id("txtSoyadi")).GetAttribute("value"); // soyadi
                var val4 = drv.FindElement(By.Id("txtKisiTCKimlikNo")).GetAttribute("value"); // T.C. No


  // I want to pull the following data into each row one by one according to the val1 value that changes each time.

        dataGridView1.Rows[i].Cells[1].Value = val2; //captured data
        dataGridView1.Rows[i].Cells[2].Value = val3; //captured data
        dataGridView1.Rows[i].Cells[3].Value = val4; //captured data

    }

 

 


Answers (2)