Skip to content

Instantly share code, notes, and snippets.

View hamzaaitbrik's full-sized avatar

Hamza hamzaaitbrik

View GitHub Profile
@hamzaaitbrik
hamzaaitbrik / getElementWithAttributeValue.js
Last active December 11, 2024 20:13
I do web automation with Selenium, and it's really hard dealing with elements nested deeply into shadowRoots. I wrote this script to return a web element with a specific tag name that has a specific value to a specific attribute. I usually use this to reutrn my target element that I can't access directly with Python's web automation frameworks, …
// !! code snippet made by hamzaaitbrik @ GitHub !!
(() => {
const matchedElements = [];
function traverse(node) {