The issue:
I have written a ton of code (to automate some pretty laborious tasks online), and have used the mechanize library for Python
to handle network requests. It is working very well, except now I have encountered a page which I need javascript
functionality... mechanize does not handle javascript
.
Proposed Solution:
I am using PyQt
to write the GUI for this app, and it comes packaged with QtWebKit
, which DOES handle javascript
. I want to use QtWebKit
to evaluate the javascript
on the page that I am stuck on, and the easiest way of doing this would be to transfer my web session from mechanize over to QtWebKit
.
I DO NOT want to use PhantomJS
, Selenium
, or QtWebKit
for the entirety of my web requests; I 100% want to keep mechanize for this purpose. I'm wondering how I might be able to transfer my logged in session from mechanize to QtWebKit
.
Would this work?
QtWebView
_VIEWSTATE
, etc.) from mechanize to QWebView
(the page is an ASP.net
page...)QWebView
to be identical to mechanize...I don't really see how I could make the two "browsers" appear more identical to the server... would this work? Thanks!
Since nobody answered, I will post my work-around.
Basically, wanted to "transfer" my session from Mechanize (the python module) to the QtWebKits QWebView (PyQt4 module) because the vast majority of my project was automated headless, but I had encountered a road block where I had no choice but to have the user manually enter data into a possible resulting page (as the form was different each time depending on circumstances).
Instead of transferring sessions, I met this requirement by utilizing QWebViews javascript functionality. My method went like this:
That's it! A bit of a work-around, but it works none-the-less :\