I wanted to check an old purchase on Google Play, but the
If nothing appears when you paste-in that querySelector line, it might be necessary to tweak that selector. The way to do that is to build-up the selector bit-by-bit and see what happens as each stage is added:
document.querySelector('body') //this HAS to return something...!
then:
document.querySelector('body>c-wiz:nth-child(5)')
(that one might need to be nth-child(3)
- try that also)
At each stage, Chrome DevTools should show something. For example:
You might find this video to be helpful: https://www.youtube.com/watch?v=SowaJlX1uKA
Let me know what you see.
CodePudding user response:
Maybe try it out with XPATH
Here:
// ==UserScript==
// @name Filter Out $0.00 Garbage
// @namespace http://tampermonkey.net/
// @version 0.1
// @description ...
// @author Me
// @match https://play.google.com/store/account/orderhistory
// @icon https://www.google.com/s2/favicons?sz=64&domain=google.com
// @grant none
// ==/UserScript==
(function() {
/**
* Get all the divs whom grand children contain a 0,00 value or 0.00 in your case
*/
const history = document.evaluate('//div[div[2]/div/div[2][contains(text(), "0.00")]]', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
/**
* Loop over all the elements found and hide them.
*/
for ( let i = 0; i < history.snapshotLength; i ) {
history.snapshotItem(i).style.display = "none";
}
})();