I have a page with, say, 30 URLS, I need to click on each and check if an element exists. Currently, this means:
$('area').each(function(){
$(this).attr('target','_blank');
var _href = $(this).attr("href");
var appID = (window.location.href).split('?')[1];
$(this).attr("href", _href + '?' + appID);
$(this).trigger('click');
});
Which opens 30 new tabs, and I manually go through them.
(all URLS are in the same domain)
It would be really nice have a crawler with the following logic:
$('area').each(function(){
1) get the HREF
2) follow it
3) on that new page:
if($('.element')){
push the $('area') into array1
} else {
push the $('area') into array2
}
});
4) Display array1 in green
Display array2 in red
Basically, Id like to generate a report that says:
X crawled pages had element Y
Z crawled pages did not have element Y
Im obviously stuck at making Javascript/jQuery work in a newly opened tab.
I've found this , this and this , but Im not entirely sure if this is viable.
Can this be done with Javascript/jQuery?
I'm only asking for the right direction, I'll do the steps myself.
Many thanks