title: How to locate/find element whose ID and xpath changes on every refresh - Selenium WebDriver Java
body: <p>I am working on selenium webdriver using java, and I am facing a problem. I have a field on a page whose id and xpath changes every time that page is loaded. Like, when I open that page manually, I can see some id and xpath, but when my test run, the id, xpath has changed.
  Example,</p>
  
  <pre><code>.//*[@id='dp1445259656810']
  .//*[@id='dp1445260051638']
  .//*[@id='dp1445260078674']
  .//*[@id='dp1445260154173']
  </code></pre>
  
  <p>these are the xpaths that are created every time I refresh my page. How can I locate/find such an element during my run test. Any help will be highly appreciated.</p>
  
  <p>Below is the HTML code for the field.</p>
  
  <pre><code>&lt;div class="form-group event-date"&gt;
      &lt;div class="input-group"&gt;
          &lt;input id="dp1445260154173" class="form-control ng-pristine ng-
          untouched ng-valid ng-isolate-scope hasDatepicker" 
          enter-action="datePickerEnter(event)" allow-empty=""
          has-datepicker="" ng-model="eventSeries.newEvent.date" 
          placeholder="Event Date"/&gt;
  
          &lt;span class="input-group-addon"&gt;
              &lt;i class="fa fa-calendar"/&gt;
          &lt;/span&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>