title: Selenium get dynamic ID XPath
body: <p>I'm new on Selenium, new here and my english is not the best. </p>
  
  <p>I'm using selenium with .NET ...</p>
  
  <p>I have a HTML page like this but the number of the events are different:</p>
  
  <pre><code>&lt;div id="eventContent" style="text-align: center;"&gt;
         &lt;div class="event" id="event-8971062"&gt;
              &lt;ul&gt;
                  &lt;li ...&gt;&lt;/li&gt;
                  &lt;li ...&gt;&lt;/li&gt;
                  &lt;li ...&gt;&lt;/li&gt;
              &lt;/ul&gt;
         &lt;/div&gt;                    
         &lt;div class="event odd" id="event-9224880"&gt;
              &lt;ul&gt;
                  &lt;li ...&gt;&lt;/li&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>I need to check all datas in the different divs but the count is dynamic and the (event)id is dynamic too. I'm trying to find out the count of the divs at first but this does'nt work. For that I try this:</p>
  
  <pre><code>DefaultSelenium selenium = new DefaultSelenium(...);
  decimal count = selenium.GetXpathCount("//div[@id='eventContent']");
  </code></pre>
  
  <p>but this brings only 1 as result and not two for this example.</p>
  
  <p>when I try:</p>
  
  <pre><code>Console.WriteLine(selenium.GetText("//div[@id='eventContent'][1]"));
  </code></pre>
  
  <p>it prints all divs, but when I do:</p>
  
  <pre><code>Console.WriteLine(selenium.GetText("//div[@id='eventContent'][1]/div"));
  </code></pre>
  
  <p>it prints only the first div and I do not understand why.
  Could someone be so kind and give me an explaination of whats going on here and where I'm wrong?</p>
  
  <p>Thanks in advance
  elur</p>