title: How to use Xpath in Selenium for getting attributes from field 'time'(JAVA)
body: <p>I use Java+Selenium for getting attributes value(datetime) and get a problem. </p>
  
  <p>This is my html:</p>
  
  <pre><code>&lt;div itemtype="garbage" class="content"&gt;
  &lt;time itemprop='datePublished' datetime='2016-03-16 22:30:03(my aim)'&gt;abnews.ru 16.03.2016 22:30&lt;/time&gt;
  </code></pre>
  
  <p>My code should have a format like: </p>
  
  <pre><code>(1) String articleDate = driver.findElement(By.xpath("myCodeHere")).getText();
  </code></pre>
  
  <p>Where my code is</p>
  
  <pre><code>div/time/@datetime
  </code></pre>
  
  <p>But in this case i got error:</p>
  
  <pre><code>div/time/@datetime' selected an object of type 'class com.gargoylesoftware.htmlunit.html.DomAttr' instead of a WebElement. 
  </code></pre>
  
  <p>For example, in case when my code is </p>
  
  <pre><code>div/time
  </code></pre>
  
  <p>i got results like: 
      "abnews.ru 16.03.2016 22:30"</p>
  
  <p>Help me anyone, how can i take this information without changing of my code format, i mean(1). </p>