title: How to put variable into find.element?
body: <p>I need to track element by <code>data-user</code> which has to a variable. Here's my code, which works:</p>
  
  <pre><code>driver.findElement(By.cssSelector("div[data-user='Caroline']")).click();
  </code></pre>
  
  <p>I add:</p>
  
  <pre><code>String UserName = "Caroline";
  </code></pre>
  
  <p>And edit <code>find.Element</code>. Here's what I've tried:</p>
  
  <pre><code>driver.findElement(By.cssSelector("div[data-user=""+ UserName]")).click();
  driver.findElement(By.cssSelector("div[data-user=''+ UserName]")).click();
  driver.findElement(By.cssSelector("div[data-user="'+ UserName +'"]")).click();
  driver.findElement(By.cssSelector("div[data-user='"+ UserName +"']")).click();
  </code></pre>
  
  <p>But these don't work. Any ideas for this one?</p>
  
  <p>EDIT:</p>
  
  <p>The case is to click a particular search result 'Caroline' as search results appear dynamically when I enter another letter to the search text.</p>