View Full Version : Fill input in QWebView

16th December 2010, 21:27
I'm forgein so my english isn't so good, but i think that you understand me.

I have a few problems with filling some inputs. Usually when I change value of input and I send it, it works that same as I fill it normally. But on the hotmail.com or imageshack.us (when I change to url) while I want to change value nothing happens after click submit button.

How can I do this? What I should use to fill those inputs?

18th December 2010, 14:16
Please, help me :)

18th December 2010, 19:41
You're asking what to use to fill the inputs and at the same time you wrote

Usually when I change value of input and I send it,
What are you using now to change the value of input, then? Can you show some code?

18th December 2010, 21:46
I mean, that when I change value usually it works. I don't use other way. I ask you about another way to fill all, not part of inputs.

I know that it's possible to do it in Qt, because I saw one program in Qt which can do it ;]

18th December 2010, 21:53
I ask you about another way to fill all, not part of inputs.
I don't understand above statement.
Can you show the code you're using now to set value of input fields and submit a form?

19th December 2010, 10:48
doc = ui->webView->page()->mainFrame()->documentElement();

QWebElement login = doc.findFirst("input[id=\"login\"]");
QWebElement password = doc.findFirst("input[id=\"password\"]");
QWebElement password_conf = doc.findFirst("input[id=\"password_conf\"]");
QWebElement answer = doc.findFirst("input[id=\"secret_a\"]");
QWebElement recapatcha = doc.findFirst("input[id=\"recaptcha_response_field\"]");

login.setAttribute("value", ui->lineEdit->text());
password.setAttribute("value", ui->lineEdit_2->text());
password_conf.setAttribute("value", ui->lineEdit_2->text());
answer.setAttribute("value", ui->lineEdit_3->text());
recapatcha.setAttribute("value", ui->lineEdit_4->text());

I only fill inputs and I sumbit it by myself in QWebView. It hard to me, explain this what I want to do. But I belive you will understand me ;]


I think that I should use Requests to do it, am I on good way?