title: How to select element in span dropdown menu cssSelector webdriver Java
body: <p>I am trying to select these elements in webdriver, after I click a button which opens a drop down menu. I can click the button fine and it drops down with. </p>
  
  <pre><code>WebElement providers = driver.findElement(By.id("providers"));
        providers.click();
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>&lt;input id="providers" class="providersOff" type="button"&gt;
  &lt;div id="providers-list" class=""&gt;
      &lt;ul&gt;
          &lt;li ng-click="searchProvider(0)"&gt;
              &lt;div class="imageContainer"&gt;
                  &lt;span&gt;Google&lt;/span&gt; &lt;--TRYING TO SELECT THIS
  </code></pre>
  
  <p>I'm trying to select the <code>Google</code> element.</p>
  
  <p>I have tried both of these and it doesn't work:</p>
  
  <pre><code>driver.findElement(By.cssSelector(".imageContainer[Google]"));
  driver.findElement(By.cssSelector(".providers-list &gt; li[ng-click*= searchProvider(0)]"));
  </code></pre>
  
  <p>It runs these perfectly fine:</p>
  
  <pre><code>  // Assign search-bar &amp; send keys
        WebElement searchbar = driver.findElement(By.id("txtSearch"));
        searchbar.sendKeys("Pizza");
  
  
        // Assign provider drop-down &amp; click
        WebElement providers = driver.findElement(By.id("providers"));
        providers.click();
  </code></pre>