title: OpenQA.Selenium.NoSuchElementException was unhandled by user code in c# selenium
body: <p>I want to wait my selenium programe for max 30 seconds (GlobalVar.timetomaximumwait) with explicit wait.But when ever its unable to locate the element its pausing at wait.until(...) line and displaying <strong>OpenQA.Selenium.NoSuchElementException was unhandled by user code</strong> 
  If i press continue or press F10 its trying again to find the element and continuing the same for my defined time spam.
  Not able to understand why the programme paused and the error message is coming in between.
  I am using VS2010, c#, selenium 2.45,Ie 9</p>
  
  <p>Any kind of help is much appreciated .</p>
  
  <pre><code> public string SetValueInTextBox(string InputData, string xPathVal)
          {
              try
              {
                  WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(GlobalVar.timetomaximumwait));
                   wait.Until&lt;IWebElement&gt;((d) =&gt;
                  {
                      return d.FindElement(By.XPath(xPathVal));
                  });
                   IWebElement TargetElement = driver.FindElement(By.XPath(xPathVal));
  
                 // IWebElement TargetElement = driver.FindElement(By.XPath(xPathVal));
  
  
                  elementHighlight(TargetElement);
                  TargetElement.Clear();
                  TargetElement.SendKeys(InputData);
  
                  //driver.FindElement(By.XPath(xPathVal)).SendKeys(InputData);
  
  
                  return "Pass";
              }
              catch (Exception e)
              {
                  return "Fail";
              }
              finally
              {
                 // string SSName = "temp.jpg";
                  TakeScreenshot("SetValueInTextBox");
  
              }
          }
  </code></pre>