Important: Please read the Qt Code of Conduct -

QWebElement and ComboBox

  • So im using QWebElement to fill up a online form and im having some trouble with the country combobox.
    My code is somehitng like this:

    QWebElement document = frame->documentElement();
    QWebElement country_element = document.findFirst("select[id=countryCombobox]");
    QWebElementCollection country_option = country_element.findAll("option");
    for(QWebElementCollection::iterator it = country_option.begin(); it != country_option.end(); it++) {
        if((*it).attribute("value") == "DE") {
            (*it).setAttribute("selected", "true");

    So for instance if i want to select Germany it dosent do what i really want. It selects Germany in the list but it dosent put it as the selected value.(instead of --)

    Picture Here

Log in to reply