Is there a way I could loop through each h2 element click it then scrape? This would be because the h2 elements are closed and it would be good to expand them to see the data and then extract the data. Since these elements don't already have click events, I assume this will need to somehow be hooked to it? But i'm not quite sure how to do this. I have had trouble previously with PhantomJS executing javascript like this before scraping because only PhantomJS 2.x was able to do what i required.
What i think the code might look like BUT where/how do i implement this for chimera to invoke?
`
var selector = 'h2';
function (selector) {
var els = $(selector);
$.each(els, function (idx, el) {
var event = document.createEvent('MouseEvent');
event.initEvent('click', true, true);
el.dispatchEvent(event);
});
Is there a way I could loop through each h2 element click it then scrape? This would be because the h2 elements are closed and it would be good to expand them to see the data and then extract the data. Since these elements don't already have click events, I assume this will need to somehow be hooked to it? But i'm not quite sure how to do this. I have had trouble previously with PhantomJS executing javascript like this before scraping because only PhantomJS 2.x was able to do what i required.
What i think the code might look like BUT where/how do i implement this for chimera to invoke?
` var selector = 'h2'; function (selector) { var els = $(selector); $.each(els, function (idx, el) { var event = document.createEvent('MouseEvent'); event.initEvent('click', true, true); el.dispatchEvent(event); });