Testing a Selector

If you have a Selector and you want to double check what it is picking up on the page, you can do the following to find out.

  • (Google Chrome) Go to View > Developer > Developer Tools.
  • A new window will show up, click the tab called Console.
  • Type in the following, replacing SELECTOR with your selector. Do not remove the quote marks.
var sfs = 'SELECTOR';
var sfd = '.';

document.querySelectorAll(sfs).forEach(e => {
    console.log(parseFloat(
        (e.textContent || e.innerText)
            .replace(/\((?=\d+)(.*)\)/, "-$1")
            .replace(new RegExp("[^0-9-" + sfd + "]", ["g"]), '')
            .replace(sfd, '.')
    ), e);
});

It will then list the value it has found and from which elements.