Hi Experts,
I need in a loop done through ExecuteScript to access a custom attribute of IMG in an HTML page. HTML code is written as below:
< img src=“link_image.png” custom_id=“XYZ” id=“ABC” >
My target is to extract all “custom_id” of all IMG that have link_image_png link.
Using a code suggested in forum and reported below, I usually access ID tag without problems, but I cannot retrive “custom_id” tag. I’ll receive only a null.
const ids = document.querySelectorAll(‘img’)
const data = []
for (const x of ids){
var temp_id = x.id
var temp_src = x.src
if ( temp_src == “link_image.png” ) {
data.push(temp_id)
} else {
}
}
return data
Thank you for your help!