DEV Community

Bruce Axtens
Bruce Axtens

Posted on

The Delight of Browser DevTools

I was on the Moz.com site, in their notifications panel (which you can't get to without a login and I'm not giving you mine!)

There I had over 800 CSV reports waiting which had been automatically generated back in June. They all needed to be archived. And the only way you can do that is click the "Messages" checkbox until a slab of 25 are selected, and then hit the "Archive" button.

The thought of doing that 32 times didn't appeal. Neither did scripting with Selenium. So I hit upon the idea of using the browser's devtools window, in this case Chrome's.

I right clicked the "Messages" checkbox, inspected the element, and worked out a simple CSS path.

var cb = document.querySelectorAll("th input[type=checkbox]")[0];
Enter fullscreen mode Exit fullscreen mode

I did the same with the "Archive" button.

var ar = document.querySelectorAll('button[test-action="archive"]')[0];
Enter fullscreen mode Exit fullscreen mode

I noticed that I had to click the checkbox twice, finally ending up with the following:

cb.click();cb.click();ar.click()
Enter fullscreen mode Exit fullscreen mode

With that in the console, it was a lot simpler and faster to simply up-arrow and press enter until all the messages had been archived.

Ah, the joys of browser devtools!

Top comments (0)