Before entering data into the input in Selenium, I clear the existing value and enter new value. However, if there is a passive input in a line, the program stops by not jumping to the next input. How can we avoid this situation?
try
{
WebDriverWait wdw = new WebDriverWait(drv, TimeSpan.FromSeconds(120));
wdw.IgnoreExceptionTypes(typeof(NoSuchElementException), typeof(ElementNotVisibleException));
var yaz1 = dataGridView1.Rows[i].Cells[3].Value.ToString();
IWebElement element = drv.FindElement(By.Id("dgListem_txtY1_" + (i)));
element.Clear();
element.SendKeys(yaz1);
}
}
catch (NoSuchElementException)
{
continue;
}
}
}
Mehmet FatihPosted Jan 12, 2024, 8:56 PM
The problem was solved by myself like that
if (chk4.Selected) //1. PERF
{
var per1 = dataGridView1.Rows[i].Cells[6].Value.ToString();
IWebElement element = drv.FindElement(By.Id("dgListem_txtSZL1_" + (i)));
if (element.Enabled)
{
element.Clear();
element.SendKeys(per1);
}
else
{
continue;
}
}