×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    79

    get attribut value from html page....

    #include <QApplication>
    #include <QWebView>
    #include <QUrl>
    #include <QWebFrame>
    #include<QWebElement>
    #include<QtGui>
    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);

    QWebView view;
    QWebPage *page;
    QWebFrame *frame;
    view.setStyleSheet("background-color:rgb(150,147,88); padding: 7px ; color:rgb(255,255,255)");
    view.load(QUrl("qrc:/index.html"));



    page=view.page();
    frame=page->currentFrame();
    // CPP file
    // this->page=this->ui->webView->page();
    // this->frame=page->currentFrame();
    //QWebElement text=frame->findFirstElement("T1");

    QWebElement text=frame->findFirstElement("#T1");
    QString value=text.attribute("value","");
    qDebug() << "INFO: Value of text is [" << value << "].";

    view.showMaximized();
    return a.exec();
    }

    this is my code ,here i am using

    <html>
    <body>
    !-- Only 1 form here -->
    <form>
    <input type="text" id="T1" name="T1" maxlength="10" value="amit sharma" />
    </form>

    </body>
    </html>

    this html code . but i am not getting the value of <input type="text" id="T1" name="T1" maxlength="10" value="amit sharma" /> this tag in my qDebug() << "INFO: Value of text is [" << value << "]."; this qdebug so plz help me where i have fault in my code .
    please help me
    amit

  2. #2
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: get attribut value from html page....

    There are all sorts of attributes of QWebElement you could print out, to see if you're where you think you are.

  3. #3
    Registered User
    Join Date
    Nov 2010
    Posts
    79

    Re: get attribut value from html page....

    can you give me any demo example for this ?

  4. #4
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: get attribut value from html page....

    Just print out a bunch of attributes -- see what you find. It will be good practice on reading the specs and will help you understand QWebElement better.

Similar Threads

  1. how to get value of web page...
    By satish1985 in forum Symbian User Interface
    Replies: 3
    Last Post: 2010-12-16, 13:24
  2. Replies: 7
    Last Post: 2010-02-18, 09:37
  3. httplib and urllib - how to get value from HTML
    By pinky_chakde in forum Symbian
    Replies: 0
    Last Post: 2008-11-06, 12:19
  4. Replies: 0
    Last Post: 2005-02-17, 07:15

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×