如何在JavaScript执行后获取URL的内容

Imagin you have an url (https://www.google.fr/)
You wan't to have the HTML code of this page after the execution of the JavaScript of this page.
Imagin the basic HTML before javascript execution is this :

<html>
    <head>
        <title>Super test</title>
    </head>
    <body>
        <script>
            var i = document.createElement("div");
            i.className = "test";
            document.bodu.appendChild(i);
        </script>
    </body>
</html>

What i need is a code (a way) to get this result :

<html>
    <head>
        <title>Super test</title>
    </head>
    <body>
        <div class="test"></div>
        <script>
            var i = document.createElement("div");
            i.className = "test";
            document.body.appendChild(i);
        </script>
    </body>
</html>

I tryed this options :
- stackoverflow (But did not succeed to use it)
- PHP PhantomJS (But when i'm trying to use it, it give me the code before javascript execution).

You need to wait for the DOM to be ready. https://api.jquery.com/ready/

And use body instead of bodu :)

If you want to see the html of the document after the javascript is executed, use document.documentElement.innerHTML.

Try this, i added setTimeout in your original page which opens up alert box and displays you the modified page with "test" div.

<html>
    <head>
        <title>Super test</title>
    </head>
    <body>
        <script>
            var i = document.createElement("div");
            i.className = "test";
            document.body.appendChild(i);
        </script>
        <script>
        setTimeout(function() {
        alert(document.documentElement.innerHTML);
        },2000);
        
        </script
    </body>
</html>

</div>