function getElementByXpath(path) { return document.evaluate(path, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); } function twitterXPath(nth, sendResponse) { let a = getElementByXpath(`(//article[contains(@role,'article')])[${nth}]//a[contains(@href,'/photo/')]//img/@src`); let arr = []; for (i=0; i