title: Using a variable in xpath in Python Selenium
body: <p>I've been having trouble figuring out how to get a variable to work Selenium. This post seems to have helped (<a href="https://stackoverflow.com/questions/28034207/variable-not-working-inside-parenthesis">Variable not working inside parenthesis</a>) but I still can't get it to work.</p>
  
  <p>When I used the actual value it works. In this case AL-Alabama. I created a variable called state so that I can just call
  that in my function. I have 13 states to run through.</p>
  
  <pre><code>driver.find_element_by_xpath("//option[@value='AL-Alabama']").click()
  </code></pre>
  
  <p>This one uses the state variable and in looking at error message it shows the variable value as AL-Alabama. So it seems like
  it's referencing the correct value in the web page. Not sure what I'm missing or why it's not working. Any guidance would be appreciated.</p>
  
  <pre><code>driver.find_element_by_xpath('//option[@value=' + state + ']').click()
  selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//option[@value=AL-Alabama]"}
  </code></pre>