Get Image value on source page using Python or Js

315 views Asked by At

Actually I am using google charts.

<html>
  <head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Task', 'Hours per Day'],
          ['Work',     11],
          ['Eat',      2],
          ['Commute',  2],
          ['Watch TV', 2],
          ['Sleep',    7]
        ]);

        var options = {
          title: 'My Daily Activities',
          is3D: true,
        };

        var chart = new google.visualization.PieChart(document.getElementById('piechart_3d'));
        chart.draw(data, options);
        var imgUrl = chart.getImageURI();
        $('#piechart_3d').prepend('<img src = "'+imgUrl+'">');
      }
    </script>
  </head>
  <body>
    <div id="piechart_3d" style="width: 900px; height: 500px;"></div>
  </body>
</html>

this was my html code. I can see the img src vlaue on inspect element , but not in the view source.

my python code is

url = 'index.html' // the above html code
content  = urllib2.urlopen(url)
data = content.read()

while printing the data I can get only is still empty .the image part is not loaded. How to construct the data with all those things without selenium and browser events. How to do on program. .

Thanks in advance.

0

There are 0 answers