I am trying to verify the open graph meta tag & in our site. Here is the HTML code:
<div class="atg_store_applicationResourceContainer">
</div>
<meta name="robots" content="index, follow" />
<!-- Coming inside regular metadetails-->
<!-- contentKey = -->
<!-- SEOTagID - **** -->
<title>Sectional Living Rooms </title>
<meta name="description" content="Find Sectional Living Rooms&nbsp; that will look great in your home and complement the rest of your furniture." />
<meta name="author" content="EXAMPLE.com" />
<meta name="google-site-verification" content="UscxdOsY5bXX9hk_Y0GILMPvzsL66vDcHHwkZZ7Gxpg" />
<meta property="og:title" content="Sectional Living Rooms "/>
<meta property="og:site_name" content="EXAMPLE"/>
<!-- requestSocialUrl = http://www.example.com/cartridges/PageSlot/PageSlot.jsp -->
<!-- customCanonical = http://www.example.com/furniture/Living-Rooms/Sectional-Living-Rooms/_/N-8wh -->
<link rel="canonical" href="http://www.example.com/furniture/Living-Rooms/Sectional-Living-Rooms/_/N-8wh" /> <!-- add + instead of space in words for SEO -->
<meta property="og:image" content="http:/images/unavailable.gif?$PDP_Cart_Primary_150x150$" />
<meta property="og:type" content="product"/>
<meta property="og:url" content="http://www.example.com/furniture/Living-Rooms/Sectional-Living-Rooms/_/N-8wh"/>
<meta property="og:description" content="Find Sectional Living Rooms&nbsp; that will look great in your home and complement the rest of your furniture.&nbsp;#iSofa #abc"/>
<script>var _adblock=true;</script>
I am trying to get the value of the content
attribute from meta
tags having the property
attribute value as og:title
& og:description
. Any help would be helpful.
I am able to find get the content of the meta with names but am not able to get the content of <og:title>
& <og:description>
as the tag does not have a name
We are using both UFT & Selenium Webdriver (Java). So I can use help on any single one.
For Selenium you can go with xpath like
//meta[@property='og:title']
//meta[@property='og:description']
And to get the content use getAttribute()
method of the WebElement
WebElement titleEl=driver.findElement(By.xpath("//meta[@property='og:title']"));
String titleContent = titleEl.getAttribute("content");