How to take screenshot of particular element in a web site



  • Is it possible to take screenshot of particular element in a web page.

    by using "mainFrame->render" function, I can get screenshot of the entire web page; however, I am only interested in particular element. for example: id="test"

    QWebElement document = mainFrame->documentElement();
    QWebElement test= document.findFirst("#test");
    test.geometry();

    I was plan to use geometry to capture the coordination, and hopefully to use it to crop the image.
    Anyway, it always returns QRect(0,0 0x0) when I tried to get geometry of my element.

    What could be the issue or is there any alternative to achieve the same goal?

    Thanks, in advance.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.