Selenium CheckBox Click When working on the computer, the same codes error on the website. What is the solution of this error?

private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
WebDriverWait wait = new WebDriverWait(drv, TimeSpan.FromSeconds(100));
IWebElement fileInput = wait.Until(drv =>
{
var element = drv.FindElement(By.Id("chkS2"));
element.Click();
return element.Displayed ? element : throw new NoSuchElementException();
});
}