title: Can we find xpath of a text in selenium python
body: <p>Consider following table in webpage
  <a href="https://i.stack.imgur.com/8VbQB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8VbQB.png" alt="enter image description here"></a></p>
  
  <p>I want to know which are all companies are from country UK.
  So i have input as UK 
  Can i find the xpath of this 'UK' by selenium python so that i can modify that xpath to get related output.
  Is this possible, please let me know.</p>
  
  <p>Thanks in advance</p>
  
  <p>Edit: I will give UK as input, I have to find corresponding companies in UK
  Answer : 
  If table contains only texts, then
  <code>xpath = "//td[text()='Country']/preceding-sibling::td" </code>
  If table elements are having links to other pages<br>
  xpath - <code>"//a[text()='Country']/parent::td/preceding-sibling::td"</code> , then select ur element of ur choice to find answer</p>
  
  <p>If ur not sure about using text , u can use 
  <code>//TAG[contains(text(),'TEXT')]</code></p>
  
  <p>U can test ur xpaths in Google Chrome's "Developer Console" 
  <code>$any_variable("xpath")</code></p>
  
  <p>Interested can go through <a href="https://www.w3.org/TR/2017/REC-xpath-31-20170321/#id-introduction" rel="nofollow noreferrer">https://www.w3.org/TR/2017/REC-xpath-31-20170321/#id-introduction</a> to know how to query XPaths</p>
  
  <p>Thanks</p>