title: Set page size in QWebView in PyQt4
body: <p>I write a python script using PyQt4 to crawl web pages including AJAX. It worked, but it can only get 'one-screen' page which I think relates to the screen resolution. I run the script on  CentOS server which doesn't have X environment. I use <strong>Xvfb</strong> and do the following settings:</p>
  
  <pre><code>$ Xvfb :100 -screen 0 9000x9000x24 &amp;
  $ export DISPLAY=:100
  </code></pre>
  
  <p>but it didn't help to get more web info.</p>
  
  <p>I'm new to PyQt4. Is there a method to set the QWebView size to enlarge the display window size?</p>
  
  <p>Any manual about QtWebkit is also appreciated.</p>
  
  <p>The following is my code:</p>
  
  <pre><code>#!/usr/bin/env python
  #coding: utf-8
  
  
  import sys
  
  from PyQt4.QtCore import QUrl, SIGNAL, QSize
  from PyQt4.QtGui import QApplication
  from PyQt4.QtWebKit import QWebPage, QWebView, QWebSettings
  
  class WebPage(QWebPage):
  
      def javaScriptConsoleMessage(self, message, lineNumber, sourceID):
          sys.stderr.write('Javascritp error at line number %d\n' % (lineNumber))
          sys.stderr.write('%s\n' % (message, ))
          sys.stderr.write('Source ID: %s\n' % (sourceID, ))
  
  
  class Crawler(QApplication):
  
      def __init__(self, url):
          super(Crawler, self).__init__(sys.argv)
          self.url = url
          self.web_view = QWebView()
          self.web_page = WebPage()
          self.web_view.setPage(self.web_page)
          self.web_frame = self.web_page.currentFrame()
  
          print 'Before connecting'
          self.connect(self.web_view, SIGNAL('loadFinished(bool)'), self.loadFinished)
          print 'After connecting'
  
          print 'Before loading'
          self.web_frame.load(QUrl(self.url))
          print 'After loading'
  
      def loadFinished(self, ok):
          self.web_page.setViewportSize(self.web_page.mainFrame().contentsSize())
          print 'In callback, before writing'
          with open('jd.txt', 'ab+') as fp:
              fp.write(self.web_page.currentFrame().toHtml().toUtf8())
          print 'In callback, after writing'
  
  
  if __name__ == '__main__':
      url = 'http://www.360buy.com/product/707047.html'
      crawler = Crawler(url)
      sys.exit(crawler.exec_())
  </code></pre>