2

Im using QWebEnginePage to get content of some webpage. In the .pro file i have mentioned CONFIG-=gui.

However when i run the program in a headless system, it complains of being unable to connect to display:0. I also noticed that it requires libX11-xcb.so & related libs.

Is there anyway i can get the HTML of a page using QtWebEngine in headless mode without having to use xvfb?

9
  • I think there other alternatives to get the content of a webpage in Qt. Commented Feb 14, 2017 at 19:51
  • @Redanium My requirement is to get the html of an ajax site. So I was looking for a headless browser to execute the javascript to generate the HTML. Please suggest if there is any alternative Commented Feb 15, 2017 at 6:01
  • Why don't you use QNetworkAccessManager with QNetworkReply Commented Feb 15, 2017 at 8:00
  • @Redanium as for as i understand these classes, dont execute javascript and ajax call in the web page Commented Feb 18, 2017 at 17:01
  • have a look at thisQtwebengine How do I run web engine on a sever without a display? and this -SOLVED- QtWebEngine headless? Commented Feb 21, 2017 at 20:25

2 Answers 2

2

QtWebEngine is memory hungry compare to QtWebKit (single process version).

  • QtWebkit didnt render some sites properly.
  • QtWebEngine needed Xserver hence consumed more memory. Plus the multiple process design, even if you have a single tab

Finally switched to puppeteer. I know that this is not the direct answer to the question posted. But this solves the original problem of extracting DOM HTML of an ajax site in true headless mode.

Sign up to request clarification or add additional context in comments.

Comments

1

"My requirement is to get the html of an ajax site. So I was looking for a headless browser to execute the javascript to generate the HTML. "

A spider may satisfy your requirement. With Scrapy and Chrome, you can do anything a browser can do.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.