0

I can clearly highlight a div with inspector, but no matter how I querySelect, by class, id or any combination thereof, the querySelector always returns null. It makes no sense.

Go here: https://www.glassdoor.com/Job/software-engineer-intern-jobs-SRCH_KO0,24.htm?jobType=internship&includeNoSalaryJobs=false

Click the listing "Datix" listing, and click Easy Apply.

Then try querySelect ing any of the things in that modal. It doesn't work. It's like it's not even in the DOM. For example: try this: document.querySelector("div[class*=ia-ApplyFormScreen]"); which is the div that you see in the center of the screen.

Interestingly, if you querySelect that div's wrapper, it appears just fine. I'm a little confused.

Edit: It seems the divs that can't be accessed are inside an iframe. But it shouldn't make a difference. The other listings are also inside an iframe, but they work fine...

Edit: In this answer, https://stackoverflow.com/a/28778893/11606097, it says iframes from another origin are like a black box. But if you look at the Reflexion listing, two rows above Datix, it sources an iframe from apply.indeed.com and querySelecting the labels works fine.

Edit: https://stackoverflow.com/a/26280437/11606097 It might be an issue with window.postMessage. I remember seeing that it wasn't correctly loaded in the logs sometimes. That might explain why it sometimes works, and sometimes doesn't.

Edit: The error seems to be

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://apply.indeed.com') does not match the recipient window's origin ('https://www.glassdoor.com').

I don't know why this error doesn't appear on the other listings.

After googling some more, it seems this error happens when postMessage is called before the iframe finishes loading. The content seems to be there though, so I guess the code tries again later, and succeeds, but the DOM doesn't get updated...or something? I think I'm going to have to give up on this one for now. It doesn't seem to be anything that can be solved client-side.

Qrow Saki
  • 528
  • 1
  • 10

0 Answers0