title: Appium get xpath from element?
body: <p>I have code which retrieves a static text element for me fine but what I want to do is then get the xpath of that element as a string. I'm using ruby. At this point I have an array of elements I have already retrieved. Below is what I've tried but no luck. </p>
  
  <pre><code>elements.each do |element|
  
    if element.attribute("name").include? vProblem
      p "Problem found, retrieving xpath..."
  
      # Neither of these work
      p "Problem xpath is: " + element.attribute("xpath").to_s
      p "Problem xpath is: " + element.xpath.to_s
  
    end
  end
  </code></pre>