Selenium.prototype.assertMetaRobotTags = function(thisIndex, thisFollow)
{
var expectedIndex = thisIndex.toLowerCase();
var expectedFollow = thisFollow.toLowerCase();
var actualIndex;
var actualFollow;
var xpath = "robots\") and (contains(@content, \"index\") or contains(@content, \"follow\"))]";
var xpathCommand = "xpath=" + xpath;
try
{
var element = this.page().findElement(xpathCommand);
}
catch (e)
{
var message = 'Test failed:\n' + "Meta Robots Tag not found";
LOG.error(message);
Assert.fail(message);
return;
}
var content = element.getAttribute("content").toLowerCase();
actualIndex = (content.indexOf("noindex")>-1)
? "noindex"
: (content.indexOf("index")>-1)
? "index"
: "undefined";
actualFollow = (content.indexOf("nofollow")>-1)
? "nofollow"
: (content.indexOf("follow")>-1)
? "follow"
: "undefined";
LOG.info("Actual Index: " + actualIndex + " - Actual Follow: " + actualFollow);
Assert.matches(expectedIndex, actualIndex);
Assert.matches(expectedFollow, actualFollow);
};