Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Setting attribute in webpage and press button 'GO'
Forum Update on Monday, May 27th 2025

Setting attribute in webpage and press button 'GO'

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    appollosputnik
    Banned
    wrote on 21 Jun 2013, 04:38 last edited by
    #1

    I am developing a web application. I need to select an option from dropdown in a website and press 'GO' button.

    I am connect with the website like as below.

    [code]
    QNetworkAccessManager m_manager = new QNetworkAccessManager(this);
    connect(m_manager, SIGNAL(finished(QNetworkReply
    )), this, SLOT(replyFinished(QNetworkReply*)));
    m_manager->get(QNetworkRequest(QUrl("http://www.mysite.com/")));

    m_WebPage = new QWebPage();
    m_WebPage->setNetworkAccessManager(m_manager);
    QString attr = m_WebPage->mainFrame()->documentElement().setAttribute("Diablo 3 (Diablo III)", "MySelection");
    [/code]

    but with this my application crashing. Please tell me how can set an attribute in a webpage and press go. How can I get the attribute and the button 'GO' in my application.

    Any suggestions is highly appreciated. Thanks Sujan

    1 Reply Last reply
    0
    • A Offline
      A Offline
      appollosputnik
      Banned
      wrote on 22 Jun 2013, 12:47 last edited by
      #2
      To select 2 options I do the following. And also click. But the values in my QWebView are not changing based on this. Please help whats wrong going on.
      

      [code]
      QWebElement selectBox =
      m_WebView->page()->mainFrame()->findFirstElement("select[id=gameid]");

      selectBox.setAttribute("value", "187");
      
      QWebElement selectBox2 =
             m_WebView->page()->mainFrame()->findFirstElement("select[id=hostid]");
      
      selectBox2.setAttribute("value", "24351");
      
      
      QWebElement button = m_WebView->page()->mainFrame()->documentElement().findFirst("input[type=button]");
      button.evaluateJavaScript("this.click()");
      

      [/code]

      1 Reply Last reply
      0

      1/2

      21 Jun 2013, 04:38

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved