How to use xpath in selenium python?
<p>I am new to Selenium Python. I am trying to run the following snippet. It works with find_element_by_name but not find_element_by_xpath.</p>

<p>Any idea what I am doing wrong?</p>

<p>Thanks </p>

<pre><code>from selenium import webdriver
# create a new Firefox session
driver = webdriver.Firefox()
driver.implicitly_wait(10)
driver.maximize_window()
# navigate to the application home page
driver.get("https://www.google.co.uk/")
# get the search textbox

#search_field = driver.find_element_by_xpath("//@name='q'/")  &lt;&lt;&lt;&lt;&lt; NOT Working
search_field = driver.find_element_by_name("q")

search_field.clear()
# enter search keyword and submit
search_field.send_keys("phones")
search_field.submit()
</code></pre>

<p>Try this
search_field = driver.find_element_by_xpath("//input[@name='q']")</p>

python selenium xpath