title: Python Selenium select xpath with variable
body: <p>I am trying to locate a visible element that will change based on what the user enters on the website. I am successful if use the follow with a static xpath search string:</p>
  
  <pre><code>wait.until(EC.visibility_of_element_located((By.XPATH, "//a[text()='Default-Test']")))
  </code></pre>
  
  <p>Default-Test will change arbitrarily and i have how to get this value but I have not been successful using a variable in the xpath search:</p>
  
  <p>Test method 1 Does not work</p>
  
  <pre><code>dtg_found = "Default-Test" 
  </code></pre>
  
  <p>Test method 2 does not work, this is the actual method for locating the value</p>
  
  <pre><code>dtg_found = driver.find_element_by_name("result[0].col[1].stringVal").get_attribute("value")
  
  dtg_opt_1 = wait.until(EC.visibility_of_element_located((By.XPATH, "\"//a[text()='" + dtg_found + "']" + '"'))) 
  </code></pre>