title: Locator fails randomly with Selenium and ChromeDriver in headless mode
body: <p>I have a drop down menu which has the text "My Menu". Unfortunately the same drop down is used for another purpose with the text "My Second Menu". I need to click on this "My Menu" drop down and it looks like the following.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;div class="c-composedDropdown u-display--flex u-align-items--center u-color--white u-cursor--pointer u-border-radius"&gt;
    &lt;div class="u-display--flex u-align-items--center"&gt;
       &lt;span class="flag-icon flag-icon-lg flag-icon-ie composedDropdown__subTitle__icon u-color--white" /&gt;
       &lt;div&gt;
          &lt;div class="u-display--block u-display--flex u-align-items--center"&gt;
             &lt;span class="u-font-weight--bold u-margin-right--medium"&gt;My Menu&lt;/span&gt;
             &lt;svg xmlns="http://www.w3.org/2000/svg" baseProfile="tiny" width="24" height="24" fill="currentColor" color="#37454D" viewBox="0 0 24 24" class="c-composedDropdown__arrow-icon u-color--blue-lighter"&gt;
                &lt;path fill="none" stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M9.5 7l5 5m-5 5l5-5" class="svg-color--primary" /&gt;
             &lt;/svg&gt;
          &lt;/div&gt;
          &lt;p class="c-composedDropdown__subTitle u-display--block"&gt;Sample&lt;/p&gt;
       &lt;/div&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>At the moment, I'm using XPath to capture this and it looks like the following.</p>
  
  <pre><code>//*[contains(@class, 'c-composedDropdown') and contains (.,'My Menu')]
  </code></pre>
  
  <p>The test scenario for this passes fine whenever I run it alone. But when the entire test suite runs, randomly this test fails. That too when running in headless mode. Is there something I can do about the way I pick this element to be clicked? Will that help the test not so flaky? Any suggestions would be much appreciated.</p>