0
Hello, I am writing an extension with the following goal: access the target elements of a page (type Document.querySelector('.Jobs')) and from there write the rest of the instructions. However, from what I read, content scripts access the DOM in an isolated environment (so when I request "DOCUMENT" return as if the DOM of the page was empty) and wanted a help on how I can fix it. Detail: I have already researched about the subject in all dev sites, including the http://developer.mozilla.org. Before giving up the project I came to try one last light here. Thanks people.
Edit: background js.
chrome.browserAction.onClicked.addListener(function(tab){
chrome.tabs.create({active: true, url: 'https://www.sine.com.br/vagas-empregos-em-contagem-mg'}, function(){
console.log('criada');
});
});
chrome.tabs.executeScript({
file: "execute.js"
});
execute js.
setInterval(() => {
var vagasList = document.querySelector('.jobs').childNodes;
n = [];
vagasList.forEach(element => {
if(element.nodeName != '#text') {
var enfia = n.push(element.children[0].children[1].href);
var ind = n.indexOf(element);
if (ind > 2) {
n.splice(ind);
}
}
});
n.forEach(element => {
console.log(element);
open(element);
vagas = setInterval(function(){
document.querySelector('.pnl-candidatar').children[0].click();
console.log('ok');
}, 1000);
});
}, 5000 );
If you post the code it is easier to get help.
– LeAndrade
Here are the codes
– Weslei