title: Finding elements that the id increases by 1 C# Selenium
body: <p>So I am trying to select an element that has an Id of &quot;edit-&quot;. The problem is the element is dynamic. So there could be nothing, 5 different ones, or one. In each case the number following the dash changes based on what edit button I want to select. I am not sure how to &quot;choose&quot; what one I want in a method.</p>
  <p>Currently the code I have is</p>
  <pre><code>private ReadOnlyCollection&lt;IWebElement&gt; referenceEditButtons =&gt; driver.FindElements(By.Id(&quot;edit-0&quot;));
  
  public void EditReference(int reference)
      {
          this.referenceEditButtons[reference].Click();
      }
  </code></pre>
  <p>The problem is there technically is only 1 instance of edit-0 on the webpage. I would have to make a variable for each edit button which I want to see if I can stay away from since it would add a bunch of variables and methods. So is there a way to simplify this to make the &quot;referenceEditButtons&quot; variable be able to select any version of &quot;edit-&quot; that I would need it to or something different?</p>