0

In browser console I can't find element inside iframe(after page reload) until I make some clicks in it. After clicks it works perfectly. Does anybody know how to deal with it?

Thanks in advance for any help.

1 Answers1

0

If you need to access the iframe elements :

window.frames['myIFrame'].contentDocument.getElementById('myIFrameElemId')

As mentioned here Access iframe elements in JavaScript, be careful that the src of the iframe is in the same domain as the parent page.

You may need to wait for the iframe to fully load. Check out this post on how to use the iframe onload event : Capture iframe load complete event.

If you just want to access them from the console, inspect one of the iframe's elements, then the browser will append the whole iframe content on the current page.

I hope this could help you.

alx.lzt
  • 456
  • 4
  • 12
  • It is in the other domain, but as it works sometimes from console I hope there is a way to do this. window.frames['myIFrame'].contentDocument.getElementById('myIFrameElemId') - Not worked, it was blocked by browser security ;( – Денис Свидунович Dec 05 '17 at 07:25