Skip to content

Instantly share code, notes, and snippets.

View robwhitaker's full-sized avatar

Robert Whitaker robwhitaker

View GitHub Profile
@iiLaurens
iiLaurens / code.js
Last active April 22, 2024 12:36
Get all clickable elements on a page
window.scrollTo(0, 0)
var bodyRect = document.body.getBoundingClientRect();
var items = Array.prototype.slice.call(
document.querySelectorAll('*')
).map(function(element) {
var rect=element.getBoundingClientRect();
return {
element: element,
include: (element.tagName === "BUTTON" || element.tagName === "A" || (element.onclick != null) || window.getComputedStyle(element).cursor == "pointer"),