Which one is correct breadcrumb structure?
Example 1:
<a href="http://example.com/topic" itemprop="url">
<span itemprop="title">Topic Archive</span></a>
<div itemprop="child" itemscope itemtype="http://data-vocabulary.org/Breadcrumb" style="display: inline;">
<a href="http://example.com/topic/parent-category" itemprop="url">
<span itemprop="title">ParentCategory</span></a>
</div>
<div itemprop="child" itemscope itemtype="http://data-vocabulary.org/Breadcrumb" style="display: inline;">
<a href="http://example.com/child-category" itemprop="url">
<span itemprop="title">Child Category</span></a>
</div>
<span>Post Title Goes Here</span>
</div>
Example 2:
<div id="breadcrumb">
<span itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a rel="home" href="http://www.example.com/topic" itemprop="url"><span itemprop="title">Topic Archive</span></a> ›
<span itemprop="child" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<span itemprop="title">Parent Category</span> ›
<span itemprop="child" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<span itemprop="title">Child Category</span> ›
</span>
<span>Post Title Goes Here</span>
</span>
</span>
</div>
Example 3:
<div id="breadcrumb">
<span itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a rel="home" href="http://www.example.com/topic" itemprop="url"><span itemprop="title">Topic Archive</span></a> ›
<span itemprop="child" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<span itemprop="title">Parent Category</span> ›
<span itemprop="child" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<span itemprop="title">Child Category</span> ›
<h1 itemprop="child" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<span itemprop="title">Current Post Title</span> ›
</h1>
</span>
</span>
</span>
</div>
Test the code here: Google Testing Tool
For example number 3, is it right to include the current page in breadcrumb schema? Do I violate any rules?
If you want to use data-vocabulary.org (which is already considered outdated), example 3 is the most correct. It is standard to include the current page in the breadcrumb. Example 1 is not correct since you have not nested your elements. In this case, you would want to add the itemref property and give ids to your divs. The itemref property should equal the id of the next child. https://developers.google.com/structured-data/breadcrumbs?rd=1
You should definitely consider moving to schema.org, since that is the format the major search engines will almost certainly agree upon. According to schema.org, none of these are the proper implementation. Your overall list should be marked as a BreadcrumbList, with each item being marked as a ListItem. Yes, by convention, the current page is the last item in the list.
https://schema.org/BreadcrumbList
Related
Currently, I am trying to get breadcrumb name and link from a website.I am writing code for getting breadcrumb name and its working perfectly but Inside loop when I try to get the breadcrumb link its show me an error.
The method getAttribute(String) is undefined for the type List
Html Code is here
<div class="breadCrumb listView" itemscope="" itemtype="http://schema.org/BreadcrumbList">
<div itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem">
<span class="separator">/</span>
<a href="https://www.flipkey.com/" itemprop="item">
<span itemprop="name">Home</span>
</a>
</div>
<div itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem">
<span class="separator">/</span>
<a href="https://www.flipkey.com/vacation-rentals" itemprop="item">
<span itemprop="name">Vacation Rentals</span>
</a>
</div>
<div itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem">
<span class="separator">/</span>
<a href="https://www.flipkey.com/united-states-vacation-rentals/g191/" itemprop="item">
<span itemprop="name">United States</span>
</a>
</div>
<div itemscope="" itemprop="itemListElement" itemtype="http://schema.org/ListItem">
<span class="separator">/</span>
<a href="https://www.flipkey.com/florida-vacation-rentals/g28930/" itemprop="item">
<span itemprop="name">Florida</span>
</a>
</div>
</div>
Here is my Code
List<WebElement> Breadcrumblist=driver.findElements(By.xpath(".//*[#class='breadCrumb listView']/div/a/span"));
List<WebElement> crumblink=driver.findElements(By.xpath(".//*[#class='breadCrumb listView']/div/a"));
for (WebElement Breadcrumb:Breadcrumblist ){
String count=Breadcrumb.getText();
String Crumblinktext=crumblink.getAttribute("href");
System.setOut(myconsole);
myconsole.print(""+count+">");
myconsole.print(""+Crumblinktext+",");
}
Error showing here
String Crumblink=crumblink.getAttribute("href");
getAttribute(String) is undefined
Not understand why this error showing.Any type of suggesting will appreciated.
This may be your requirement.
List<WebElement> crumblink=driver.findElements(By.xpath(".//*[#class='breadCrumb listView']/div/a"));
for (WebElement Breadcrumb:crumblink){
String count=Breadcrumb.findElement(By.tagName("span")).getText();
String Crumblinktext=Breadcrumb.getAttribute("href");
System.setOut(myconsole);
myconsole.print(""+count+">");
myconsole.print(""+Crumblinktext+",");
}
My problem: I'm failing to select an element in Selenium IDE, even though the target ID is filled automatically by the IDE.
Problem description:
In http://instantsearchplus.myshopify.com/, I want to type in the search field (top right).
This is the HTML code for the search field:
<input name="q" value="" aria-label="Search our store"
class="header-bar__search-input ui-autocomplete-input"
autocomplete="OfF" autocorrect="off" autocapitalize="off"
id="input_id_0_suggestor_007" isp_ac="OfF" type="search">
So, I enter the select Command, and after clicking on the search field, Selenium IDE automatically fills the Target with id=input_id_0_suggestor_007.
All is well, right?
Wrong!
When I try to run the script, I get the error
[info] Playing test case Untitled 2
[info] Executing: |open | / | |
[info] Executing: |select | id=input_id_0_suggestor_007 | |
[error] Element id=input_id_0_suggestor_007 not found
[info] Test case failed
What am I doing wrong?
Note: I tried various select related commands (select, selectFrame, selectWindow, etc. ) with a variety of possible targets (id, name, css, etc. ) - but did not find any combination that works. Click also didn't work.
The HTML code around the search field:
<div class="header-bar">
<div class="wrapper medium-down--hide">
<div class="large--display-table">
<div class="header-bar__left large--display-table-cell">
</div>
<div class="header-bar__right large--display-table-cell">
<div class="header-bar__module">
<a href="/cart" class="cart-toggle">
<span class="icon icon-cart header-bar__cart-icon" aria-hidden="true"></span>
Cart
<span class="cart-count header-bar__cart-count">2</span>
</a>
</div>
<div class="header-bar__module header-bar__search">
<form action="/pages/search-results" method="get" role="search">
<span role="status" aria-live="polite" class="isp_polite_powered_by_id ui-helper-hidden-accessible">Powered by InstantSearch+ Site Search Autocomplete</span><input name="q" value="" aria-label="Search our store" class="header-bar__search-input ui-autocomplete-input" autocomplete="OfF" autocorrect="off" autocapitalize="off" id="input_id_0_suggestor_007" isp_ac="OfF" type="search">
<button type="submit" class="btn icon-fallback-text header-bar__search-submit">
<span class="icon icon-search" aria-hidden="true"></span>
<span class="fallback-text">Search</span>
</button>
</form>
</div>
</div>
</div>
</div>
<div class="wrapper large--hide">
<button type="button" class="mobile-nav-trigger" id="MobileNavTrigger">
<span class="icon icon-hamburger" aria-hidden="true"></span>
Menu
</button>
<a href="/cart" class="cart-toggle mobile-cart-toggle">
<span class="icon icon-cart header-bar__cart-icon" aria-hidden="true"></span>
Cart <span class="cart-count">2</span>
</a>
</div>
<ul id="MobileNav" class="mobile-nav large--hide">
<li class="mobile-nav__link" aria-haspopup="true">
<a href="/" class="mobile-nav">
Home
</a>
</li>
<li class="mobile-nav__link" aria-haspopup="true">
<a href="/search" class="mobile-nav">
Search page
</a>
</li>
<li class="mobile-nav__link" aria-haspopup="true">
<a href="http://instantsearchplus.myshopify.com/pages/search-results/collections-accessories" class="mobile-nav">
Accessories
</a>
</li>
<li class="mobile-nav__link" aria-haspopup="true">
<a href="http://instantsearchplus.myshopify.com/pages/search-results/collections-best-seller" class="mobile-nav">
Best Seller
</a>
</li>
<li class="mobile-nav__link" aria-haspopup="true">
<a href="http://instantsearchplus.myshopify.com/pages/search-results/collections-gloves" class="mobile-nav">
Gloves
</a>
</li>
<li class="mobile-nav__link" aria-haspopup="true">
<a href="/pages/about-us" class="mobile-nav">
About us
</a>
</li>
</ul>
</div>
ClickAt //input works
Indeed, select command is usually meant for selecting options from a select tag.
Here's a quote from the documentation
Constructor. A check is made that the given element is, indeed, a SELECT tag. If it is not, then an UnexpectedTagNameException is thrown.
I am trying to improve SEO for a local plumber website. I am using the following elements in the contact section:
<div itemscope itemtype="http://schema.org/Plumber">
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="geo" itemscope itemtype="http://schema.org/GeoCoordinates">
I also want to list the services that are provided. These are shown in a list and include: Boiler services, Installation, Fix leaking taps etc.
How would I markup these multiple services?
You can add an OfferCatalog of Offers which are the provided Services:
<div itemscope itemtype="http://schema.org/Plumber">
<span itemprop="name">Mr. Plumber</span>
<!-- other properties e.g. address -->
<ul itemprop="hasOfferCatalog" itemscope itemtype="http://schema.org/OfferCatalog">
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/OfferCatalog">
<span itemprop="name">Services offered</span>
<ul itemprop="itemListElement" itemscope itemtype="http://schema.org/OfferCatalog">
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/Offer">
<div itemprop="itemOffered" itemscope itemtype="http://schema.org/Service">
<span itemprop="name">Service one name</span>
</div>
</li>
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/Offer">
<div itemprop="itemOffered" itemscope itemtype="http://schema.org/Service">
<span itemprop="name">Service two name</span>
</div>
</li>
</ul>
</li>
</ul>
</div>
This is based on the example for an OfferCatalog.
I'm updating Rich snippets on a recipe page and when testing the results in the Google Structured Data testing tool (https://developers.google.com/structured-data/testing-tool/). I get some errors due to the fact that the breadcrumb is in the scope of the recipe.
Is this a blocking error ?
What could be the resolution ? Some extra markup around the breadcrumb part ?
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body class="" itemscope itemtype="http://schema.org/Recipe">
<h1><span itemprop="name">Baked Cheesy Dippers with Nacho Cheese Cheddar</span></h1>
<div class="extraPropeties">
<span itemprop="description">A fun way to serve chicken dippers and keep kids interested</span>
<span itemprop="recipeYield">4 Persons</span>
<span itemprop="nutrition" itemscope itemtype="http://schema.org/NutritionInformation">
<span itemprop="calories">11</span>
<span itemprop="fatContent">31</span>
<span itemprop="proteinContent">41</span>
<span itemprop="carbohydrateContent">51</span>
<span itemprop="fiberContent">61</span>
<span itemprop="cholesterolContent">71</span>
</span>
</div>
<div class="part2">
<div class="shortInfo">
<div class="shortInfoTile">
<div class="key">Preparation time</div>
<div class="value">
<span datetime="PT10M" itemprop="prepTime">10</span><span class="unit">'</span>
</div>
</div>
<div class="shortInfoTile">
<div class="key">Cooking time</div>
<div class="value">
<span datetime="PT20M" itemprop="cookTime">20</span><span class="unit">'</span>
</div>
</div>
<div class="shortInfoTile">
<div class="key">Nr of servings</div>
<div class="value">
<span>4</span>
</div>
</div>
</div>
</div>
<div class="breadcrumb">
<div class="wrapper">
<div class="typoMinusR">
<span class="word" id='bc_0' itemscope itemtype='http://data-vocabulary.org/Breadcrumb' itemref='bc_1'>
<span class="first"></span>
<a href="/" itemprop="url">
<span itemprop="title">Home</span>
</a>
<span class="last"></span>
</span>
<span class="word" id='bc_1' itemscope itemtype='http://data-vocabulary.org/Breadcrumb' itemprop='child' itemref='bc_2'>
<span class="first"></span>
<a href="/recipes" itemprop="url">
<span itemprop="title">Recipes</span>
</a>
<span class="last"></span>
</span>
<span class="word" id='bc_2' itemscope itemtype='http://data-vocabulary.org/Breadcrumb' itemprop='child'>
<span class="first"></span>
<a href="/recipes/baked-cheesy-dippers-with-nachos-beans-cheddar" itemprop="url">
<span itemprop="title">Baked-Cheesy-Dippers-with-Nacho-Bean-Cheddar</span>
</a>
<span class="last"></span>
</span>
</div>
</div>
</div>
</body>
</html>
</html>
Nesting the http://data-vocabulary.org/Breadcrumb item in the http://schema.org/Recipe item is not a problem. Microdata does not care about the HTML5 nesting, unless a property is used (itemprop).
The problem in your case is that your 2nd and 3rd breadcrumb items (which have the child property) are not nested in the http://data-vocabulary.org/Breadcrumb item, but in the http://schema.org/Recipe item. This way they get associated with the recipe, which is of course not correct.
So the solution would be to nest the breadcrumb items, instead of using itemref.
<div class="breadcrumb">
<div class="wrapper">
<div class="typoMinusR">
<span id='bc_0' itemscope itemtype='http://data-vocabulary.org/Breadcrumb'>
<span class="word">
<a href="/" itemprop="url">
<span itemprop="title">Home</span>
</a>
<span class="last"></span>
</span>
<span id='bc_1' itemscope itemtype='http://data-vocabulary.org/Breadcrumb' itemprop='child'>
<span class="word">
<span class="first"></span>
<a href="/range" itemprop="url">
<span itemprop="title">Our Range</span>
</a>
<span class="last"></span>
</span>
<span id='bc_2' itemscope itemtype='http://data-vocabulary.org/Breadcrumb' itemprop='child'>
<span class="word">
<span class="first"></span>
<a href="/range/fish2" itemprop="url">
<span itemprop="title">Fish</span>
</a>
<span class="last"></span>
</span>
<span id='bc_3' itemscope itemtype='http://data-vocabulary.org/Breadcrumb' itemprop='child'>
<span class="word">
<span class="first"></span>
<a href="/range/fish2/inspirations" itemprop="url">
<span itemprop="title">Inspirations</span>
</a>
<span class="last"></span>
</span>
</span>
</span>
</span>
<span class="word currentitem">
<span class="first"></span>
<span class="label">Inspirations Fish Chargrills - Sun Ripened Tomato and Oregano</span>
<span class="last"></span>
</span>
</span>
</div>
</div>
</div>
I have the following html to structure my breadcrumbs:
<ul class="browsePageBC">
<li class="product-breadcrumb" itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><span class="product-breadcrumb-title" itemprop="title">Wanita</span><span class="glyphicon glyphicon-chevron-right"></span></li>
<li class="product-breadcrumb" itemprop="child" itemtype="http://data-vocabulary.org/Breadcrumb"><span class="product-breadcrumb-title" itemprop="title">Aksesoris </span></li>
</ul>
When I tested this on structured data testing tools, this is what it gives me. Wondering why it's not showing/parsing the child correctly?
Following sample code will help you to declare the parent and child property
<div id="breadcrumb">
<span itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a rel="home" href="http://www.example.com" itemprop="url">
<span itemprop="title">Home</span>
</a> ›
<span itemprop="child" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="http://www.example.com/topic/technology/" itemprop="url">
<span itemprop="title">Technology</span>
</a> ›
<span itemprop="child" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="http://www.example.com/tag/gadgets/" itemprop="url">
<span itemprop="title">Gadgets</span>
</a> ›
<span>Sweet Post Title Goes Here</span>
</span>
</span>
</span>
</div>
Let me know if these code help on your way.
Google’s documentation: Rich Snippets – Breadcrumbs
You’ll see in their examples that you either
list all entries in the correct order (without using the child property), or
use the child property in which case you would have to nest the child item under the parent item.
Note that each entry needs its own itemscope.