title: How to check if Element exists in c# Selenium drivers
body: <p>So I have this c# winform using Firefox selenium webdriers.</p>
  
  <p>Basically i need it to check if an element exists and if it doesn't click on a different one. If there is a video and after it is watched it become W_VIEWED</p>
  
  <p>Here is what i got so far</p>
  
  <pre><code>driver.FindElement(By.XPath("//div[@class='video']/a")).Click();
  else {
            driver.FindElement(By.XPath("//div[@class='W_VIEWED']/a")).Click();
       }
  </code></pre>
  
  <p>Error   3   Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement   242</p>
  
  <p>Kind of new to c# selenium. Thank you for help. </p>