Logging metadata

23 views
Skip to first unread message

Greg Martz

unread,
Jun 26, 2018, 11:35:46 AM6/26/18
to seleniu...@googlegroups.com
Good morning!

I'm using Selenium and Page Objects.  All individual page objects extends the master Page Object.  In the master Page Object, I'd like to log the pages metadata.  All meta data including the name and the content.  Here is what it looks like from our page source:

<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
    <title>
    Welcome to My Website
    </title>
    <!-- START HomeSeoMetaData.jsp -->
<meta name="currentBuildNumber" content="3.0.33666.0" />
<meta name="currentSolrBuildNumber" content="3.0.33555.0" />
<meta name="ServerName" content="www-vqa2.xxx.com " />
<meta name="LocalAddress" content="xxx.xxx.xxx.128" />
<meta name="LocalName" content="TP01" />

<meta name="google-site-verification" content="" />


<link rel="icon"  type="image/vnd.microsoft.icon" href="/wcsstore/xxxGLOBALSAS/images/favicon.ico" type="image/x-icon"> 
<link rel="shortcut icon"  type="image/vnd.microsoft.icon" href="/wcsstore/xxxGLOBALSAS/images/favicon.ico" type="image/x-icon">


<meta name="description" content="This is the description content. "/>
<meta name="keyword" content="USBC, , Electronics, Computers, Appliances , Furniture &amp; Mattresses, Tires &amp; Auto, Floral, Gifts &amp; Books, Jewelry, Watches &amp; Sunglasses, Patio, Lawn &amp; Garden, Home Improvement, Home &amp; Kitchen, Office Products, Clothing, Luggage &amp; Handbags, Health &amp; Beauty, Baby, Kids &amp; Toys, Grocery &amp; Household, Sports &amp; Fitness, View More Categories, Landing Pages, Pharmacy Feature Pages, Shop With Us for electronics, computers, furniture, outdoor living, appliances, jewelry and more. Enjoy low prices on name-brands products delivered to your door. "/> 
  </head>
</html>

Can anyone come up with a good quick, clean method to iterate through all of the meta elements logging all of the attributes and values (Mainly the "meta" elements and the text of the "title" element)?

Thanks!
Greg
Reply all
Reply to author
Forward
0 new messages