javascript - nightwatchjs meta tag check if is not empty -
i check if description meta tag has value not sure how it.
have tried no luck:
browser.verify.element("meta[name=description]").attribute('content').not.equals(''); any appreciated, thanks!
using selenium protocol "element" :
browser.element('css selector', '#advanced-search', function(result){ if(result.status != -1){ //element exists, } else{ //element not exist, else } }); plain javascript solution:
if(document.queryselector("meta[name=description]")){ if(document.queryselector("meta[name=description]").getattribute("content") === "description of webpage") console.log("meta description content 'description of webpage' found"); // } else{ console.log("meta description not found"); // } <meta name="description" content="description of webpage"/> sources: nightwatchjs: how check if element exists without creating error/failure/exception , how check existing meta tag before generating new 1 javascript (or jquery)?
Comments
Post a Comment