qwebpage

Scrape multiple urls using QWebPage

谁说胖子不能爱 提交于 2020-01-24 22:55:39
问题 I'm using Qt's QWebPage to render a page that uses javascript to update its content dynamically - so a library that just downloads a static version of the page (such as urllib2) won't work. My problem is, when I render a second page, about 99% of the time the program just crashes. At other times, it will work three times before crashing. I've also gotten a few segfaults, but it is all very random. My guess is the object I'm using to render isn't getting deleted properly, so trying to reuse it

How to follow a link in QWebKit?

这一生的挚爱 提交于 2020-01-11 02:34:23
问题 Having a DOM of the following html; <a href="?op=order"> <img class="img_button" src="picture.gif" onMouseOver="this.src='some.gif';" onMouseOut="this.src='some_other.gif';" alt="" border="0"> </a> how to follow a link (href) in QWebKit (specifically QWebPage). Please notice that it's an image that is linked. I can't do it (and I don't want to even if I could) by simulating a mouse click as I don't use QWebView thus I don't have the page rendered. 回答1: Assuming you have the link's QWebElement

QtWebView — C++ — How to get javascript string returned from linkClicked event

随声附和 提交于 2020-01-06 07:25:35
问题 I have been unable to find a definitive answer to my problem. I currently have a QWebView control load an html file that is on my hard-drive, that implements a vector map with javascript actions. The html file loads a jvectormap US States Map. The click action on any state fires the onRegionClick action that is tied to the showCities function, which the event and code arguments are handled by the onRegionClick method implemented in the jquery-jvectormap.js file. The html file follows: <

How to read data from QNetworkReply being used by QWebPage?

随声附和 提交于 2019-12-28 13:56:09
问题 I use QWebPage to download a webpage as well as all its resources. At the same time I'd like to get hold on raw data being downloaded by Qt during this process. Doing this by reading data from QNetworkReply in void QNetworkAccessManager::finished(QNetworkReply * reply) signal is not a good solution as data could have been already read by QWebPage itself. This is because QNetworkReply is a sequential-access QIODevice, which means that once data is read from the object, it no longer kept by the

PyQt: how to use QWebPage with an anonimous proxy

旧时模样 提交于 2019-12-23 12:16:56
问题 This is driving me crazy. I want to show in a QWebPage an url, but i want to do it passing by an anonimous proxy. Code #setting up the proxy proxy = QNetworkProxy() proxy.setHostName("189.75.98.199") #just examples proxy.setPort(1111) proxy.setType = QNetworkProxy.HttpProxy #setting the manager manager = QNetworkAccessManager() manager.setProxy(proxy) #setting the proxy on the manager #setting the proxy as application proxy QNetworkProxy.setApplicationProxy(proxy) #seems to do nothing.. #web

QWebEngineView modify web content before render

自闭症网瘾萝莉.ら 提交于 2019-12-22 01:29:50
问题 I have three questions about QWebengineView (Qt 5.7.0): How can I modify the web content (add extra html/javascript) during load (before render) How can I get events when javascript resource included in webpage is loading ( I want to modify them, too). I get html content by page()->toHtml then set it back by setHtml , but content rendered don't like original (seems to loss format) Thanks for help! 来源: https://stackoverflow.com/questions/38162751/qwebengineview-modify-web-content-before-render

QWebPage triggers loadFinished() several times

二次信任 提交于 2019-12-21 20:47:17
问题 I'm loading content into QWebPage, using load() method. But my loadStarted(), loadFinished() and loadProgress() handlers are calling several times. How can I detect that page is loaded completely with all it's content? 回答1: Posted a related solution proposal at: Receiving multiple loadFinished signals for a requested web page Basicly look for repaintRequested(QRect) signal of QWebPage. 来源: https://stackoverflow.com/questions/1879881/qwebpage-triggers-loadfinished-several-times

pyqt5.6 interceptRequest doesn't work

谁说胖子不能爱 提交于 2019-12-12 07:00:57
问题 I want to interceptor a url request to another by subclass QWebEngineUrlRequestInterceptor: class RequestInterceptor(QWebEngineUrlRequestInterceptor): def interceptRequest(self,info): print('#################interceptRequest') print(info.requestUrl(),info.firstPartyUrl(),info.NavigationType,info.resourceType(),info.requestMethod()) if info.requestUrl().endswith("/jquery.js"): info.redirect('/jqueryTest.js') app = QApplication([]) p = QWebEnginePage() v = QWebEngineView() v.setPage(p) p

QWebPage segmentation fault

拈花ヽ惹草 提交于 2019-12-11 08:08:54
问题 When I instantiate an QWebPage object I have a segmentation fault, I don't understand why ! I call my object in main.cpp webview *nav = new webview(); my webview.h : #ifndef WEBVIEW_H #define WEBVIEW_H #include <QRegularExpression> #include <QWebPage> #include <QWebFrame> #include <QPrinter> #include <QDebug> #include "arguments.h" class webview { public: webview(); ~webview(); bool load(Arguments *args); QWebFrame* getFrame() { return frame;} private: QWebPage *page; QWebFrame *frame; }; and

How to create Web History for my Browser

笑着哭i 提交于 2019-12-11 07:27:02
问题 I'm new to Qt. I am Trying to create a Sample Browser Application. I had created the Browser application. Now i need to create the Web history for my application. I don't know how to do it. can anyone please help me with this. Thanks in advance. 回答1: QWebHistory * QWebView::history () The Arora Browser is based in the QWebView... as mentioned here. This browser is the foundation for the Arora Browser, a simple cross-platform Web browser. I would look at how they implemented their history. In