I want to imitate a fake click with qwebelement in a qwebview. I have an answer which works with login good, but here nothing happens:
<input type='hidden' name='name' value='0'> <button id="id0" type="submit" class="btn btn-primary">Show List</button>
my Function:
int WebView::clickButton(QString inputName /* input[name=button] */ )
{
QWebElement document = this->page()->mainFrame()->documentElement();
QWebElement button = document.findFirst(inputName);
if (button.isNull()) {
std::cout << "\33[2K\r" << " => Error: Button could not be found" << std::endl;
return 1;
}
button.evaluateJavaScript("this.click()");
return 0;
}
I test it with:
clickButton("input[name=configcaptcha]");
clickButton("input[id=gethoster]");
clickButton("input[type=submit]");
clickButton("input[class=btn btn-primary]");
but either the Button couln't be found or nothing happens.