title: Webdriver. How to retrieve the xpath of found element?
body: <p>I have a bit of code that finds an element based on visible text. </p>
  
  <pre><code># Defines the text I am looking for
  productName = "customer x job"
  #Finds the element I am looking for
  inputElement = driver.find_element_by_xpath(".//*[@id='demo_top']/div/table[2]/tbody/tr/td[1]/ul/li[2]/ul/li[1]/a".format(productName))
  </code></pre>
  
  <p>I need to click a box just to the right of this. </p>
  
  <p>The specific xpath of the element is: </p>
  
  <pre><code>#What I just found
  /html/body/div[1]/div/div/table[2]/tbody/tr/td[1]/ul/li[2]/ul/li[1]/a
  #The box I actually want to click
  /html/body/div[1]/div/div/table[2]/tbody/tr/td[1]/ul/li[2]/ul/li[1]/span/a
  </code></pre>
  
  <p>So I just need to add "/span/a" to the xpath of inputElement. The issue is, I don't know the specific xpath of this element. Is there a way for me to convert inputElement to a specific xpath, so I can just append "/span/a" to the end of it and click that element?</p>
  
  <p>Edit: seems I was mistaken, I need to replace the final "a" with "span/a"</p>
  
  <p>Below is the html:</p>
  
  <pre><code>&lt;li class="TCbullet"&gt;
  &lt;span&gt;
  &lt;a class="editCategory " onclick="return hs.htmlExpand(this, { objectType: 'iframe' } );" href="cat-frame-category.php?categoryID=1340"&gt; &lt;/a&gt;  #I want to click this
  &lt;span class="sort"&gt;sort: 0&lt;/span&gt;
  &lt;/span&gt;
  &lt;a class="anchorCategory" alt="Eden Cognitive Content" href="?ownerID=C518&amp;g=1085&amp;t=1340"&gt;Eden Cognitive Content&lt;/a&gt;  # I have found this
  &lt;/li&gt;
  </code></pre>
  
  <p>I want to access the editCatagory link, and I have found the anchorCategory link. </p>