- Open Compare Reports page, e.g. https://gtmetrix.com/compare/a4lhVShE/ek3wqm50 and switch to
Waterfall
tab. - Copy paste js code to dev tools console.
- Use results.
Last active
June 10, 2022 18:24
-
-
Save alies-dev/23da264aee14a7efbc8d24f2f110a8d5 to your computer and use it in GitHub Desktop.
GTMetrics comparison snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function returnRefinedURL(url) { | |
return url.replace(new RegExp("=\\w+"),"").replace("?&","?").replace("&&","&"); | |
} | |
testsAndRequests = []; | |
document.querySelector('.report-waterfall').contentWindow.document.querySelectorAll('.vsc-initialized table .netTable').forEach((table, index) => { | |
table.querySelectorAll('.netFullHrefLabel.netHrefLabel.netLabel ').forEach((row, rowIndex) => { | |
if (rowIndex === 0) { testsAndRequests.push([]); } | |
testsAndRequests[index].push(row.textContent); | |
}); | |
}); | |
firstTestRequests = testsAndRequests[0].map(returnRefinedURL); | |
secondTestRequests = testsAndRequests[1].map(returnRefinedURL); | |
console.log('In A not in B: ', firstTestRequests.filter(x => !secondTestRequests.includes(x))); | |
console.log('In B not in A: ', secondTestRequests.filter(x => !firstTestRequests.includes(x))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment