javascript - Ruby - Watir - Get HTML with interpreted js -


after doing on ruby file :

 browser = watir::browser.new  browser.goto 'anywebsite.com'   puts browser.html > "~/index.html" 

i html code non-interpreted javascript. example, things :

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> 

my question is, how can html after js interpretation ?

thanks in advance answers !

when use html method, getting current dom - ie html after javascript interpretation.

for example, take simple html page includes javascript add button:

<html>   <body>     <script>       var btn=document.createelement("button");       document.body.appendchild(btn);     </script>   </body> </html> 

when go page , browser html, can see includes button added javascript (see end of second last line) - ie html after javascript has been interpreted:

browser.html #=> <html xmlns="http://www.w3.org/1999/xhtml"><head></head><body> #=>     <script> #=>       var btn=document.createelement("button"); #=>       document.body.appendchild(btn); #=>     </script><button></button> #=> </body></html> 

similarly, can see html of specific element after interpretation:

browser.body.html #=> <body> #=>     <script> #=>       var btn=document.createelement("button"); #=>       document.body.appendchild(btn); #=>     </script><button></button> #=> </body> 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -