title: Selenium, Java - How to click at an element using text?
body: <p>I'm having trouble with clicking at an element, which I find using text which is a variable. This is the code of the page:</p>
  
  <pre><code>&lt;div class="recommendedProfileList fl"&gt;
  &lt;h3&gt;
  &lt;ul class="ctrlResearchProfiles"&gt;
  &lt;li&gt;
  &lt;li&gt;
  &lt;li&gt;
  &lt;li&gt;
  &lt;li&gt;
  &lt;li&gt;
  &lt;span class="profileBtn ctrlSelectDefProfile ctrlClickSubmit" data-value="143" data-form="formChooseProfile" data-profileid="143"&gt;Sales manager&lt;/span&gt;
  &lt;span class="profileTooltip" style="display: none;"&gt;
  &lt;span class="arrow"/&gt;
  &lt;span class="profileTooltipContent"&gt;
  &lt;/span&gt;
  </code></pre>
  
  <p>and the name of the variable is <em>profile</em>. This is how I've tried to do this, but did not work:</p>
  
  <pre><code>WebDriverWait wait = new WebDriverWait(driver, 5);
      wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[text()=' + profile + ']")));
  </code></pre>
  
  <p>second:</p>
  
  <pre><code>driver.findElement(By.xpath("//*[text()=' + profile + ']"));
  </code></pre>
  
  <p>also:</p>
  
  <pre><code>driver.findElement(By.linkText("" +profile)).click();
  </code></pre>
  
  <p>Do you know how to click such element?</p>