Commits

Gregory Petukhov  committed 3663920

Trying to click with Kit transport

  • Participants
  • Parent commits a52392b

Comments (0)

Files changed (2)

File grab/kit/__init__.py

 """
 import time 
 import sys
-from PyQt4.QtCore import QEventLoop, QUrl, QEventLoop, QTimer, QByteArray
+from PyQt4.QtCore import QEventLoop, QUrl, QEventLoop, QTimer, QByteArray, QSize
 from PyQt4.QtGui import QApplication
 from PyQt4.QtWebKit import QWebView, QWebPage
 from PyQt4.QtNetwork import (QNetworkAccessManager, QNetworkRequest,
     def closeEvent(self, event):
         self.app.quit()
 
+    def sizeHint(self):
+        viewport_size = (800, 600)
+        return QSize(*viewport_size)
+
 
 class KitPage(QWebPage):
     def __init__(self, *args, **kwargs):

File test/kit_live_sites.py

 GRAB_TRANSPORT = 'grab.transport.kit.KitTransport'
 
 class KitLiveSitesTestCase(TestCase):
-    def test_dumpz_copyright(self):
-        g = Grab(transport=GRAB_TRANSPORT)
-        g.go('http://dumpz.org')
-        self.assertTrue('Grigoriy Petukhov' in g.response.body)
+    #def test_dumpz_copyright(self):
+        #g = Grab(transport=GRAB_TRANSPORT)
+        #g.go('http://dumpz.org')
+        #self.assertTrue('Grigoriy Petukhov' in g.response.body)
 
-    def test_dumpz_codemirror(self):
-        g = Grab(transport='grab.transport.curl.CurlTransport')
-        g.go('http://dumpz.org')
-        self.assertFalse('<div class="CodeMirror' in g.response.runtime_body)
+    #def test_dumpz_codemirror(self):
+        #g = Grab(transport='grab.transport.curl.CurlTransport')
+        #g.go('http://dumpz.org')
+        #self.assertFalse('<div class="CodeMirror' in g.response.runtime_body)
 
-        g = Grab(transport=GRAB_TRANSPORT)
-        g.go('http://dumpz.org')
-        # Dumpz.org contains javascript editor CodeMirror
-        # that builds some HTML in run-time
-        self.assertTrue('<div class="CodeMirror' in g.response.runtime_body)
+        #g = Grab(transport=GRAB_TRANSPORT)
+        #g.go('http://dumpz.org')
+        ## Dumpz.org contains javascript editor CodeMirror
+        ## that builds some HTML in run-time
+        #self.assertTrue('<div class="CodeMirror' in g.response.runtime_body)
+
+    #def test_show_gui(self):
+        #g = Grab(transport=GRAB_TRANSPORT)
+        #g.transport.kit.view.show()
+        #g.go('http://dev.twitter.com/')
+        #import pdb; pdb.set_trace()
+        #g.transport.kit.page.mainFrame().documentElement().findAll('a')[6].toPlainText();
+        #g.transport.kit.page.mainFrame().documentElement().findAll('a')[6].evaluateJavaScript('this.click()');
+