foreach (const QWebElement &selectField, selectFields) { QString name = selectField.attribute(QLatin1String("name")); int selectedIndex = selectField.scriptableProperty(QLatin1String("selectedIndex")).toInt(); if (selectedIndex == -1) continue; QList<QWebElement> options = selectField.findAll(QLatin1String("option")); QString value = options.at(selectedIndex).toPlainText(); searchUrl.addQueryItem(name, value); }