Getting span task name captcha with querySelector, only gets if body is fully open

136 views Asked by At

elements not expanded imagem

I don't know why the elements are not expanded, when I execute the command it gives this error

Uncaught TypeError: Cannot read properties of null (reading 'querySelectorAll')

*Now when I open the elements up to the specific span the command works * elements expanded imagem

const parentElement = document.querySelector('h2.prompt-text');
let allChildren = parentElement.querySelectorAll(":scope > span"); console.log(allChildren[0].innerText)
1

There are 1 answers

1
Iman Rabbi On

The captcha is rendered in the Iframe tag, You can get elements in Iframe with the below code:

var iframe = document.getElementById("myFrame");
var elmnt = iframe.contentWindow.document.querySelector("h2.prompt-text");
...