title: Getting an attribute from same level as locator using Selenium
body: <p>I'm writing tests for a quite dynamic site where objects can be added and removed from a canvas in any order and for an unknown number of times. For the current test, I need to keep track of a number of objects of a specific type and then manipulate them in a specific order.</p>
  
  <p>To make my life as a tester easier, the developers add a test-id to all objects, and that specifies what kind of an object it is.
  In order to keep track of specific objects on the canvas, I need to get the IDs since they are unique for each object. So, what I want to do for my current test is to get a list of all objects of a specific type - using the test-id, and then retrieve the ID for each of them. The structure of each of these objects looks something like this:</p>
  
  <pre><code>&lt;div test-id="object-type1" id="ember935" class=...&gt;
    &lt;div class="ObjectHeader"&gt;
      &lt;ul&gt;
        &lt;li&gt;...&lt;/li&gt;
        &lt;li&gt;...&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>So, just getting all the elements using</p>
  
  <pre><code>Driver.FindElements(By.CssSelector("*[test-id=object-type1]");
  </code></pre>
  
  <p>returns a list with all the IWebElements I'm looking for. My problem is that I can't find a way of reading the id from these elements, all I can see is the nodes below. I could also create a list with all the ID's, but then I can't filter them by looking at the test-id.</p>
  
  <p>Is there some way to do this without it getting messy by comparing different lists with each other or something similar?</p>