Reputation: 35109
On the webpage, when I create a new user, alert message displayed that 'New user was created'. And in order to continue, I have to click button 'ok'. So the thing is I don't really know how to click it.
when I need to click a regular button I do something like this:
doc = self.page().currentFrame().documentElement()
submit_button = doc.findFirst('input[id=my-submit-button]')
submit_button.evaluateJavaScript('this.click()')
But how to click button in alert message?
Upvotes: 1
Views: 380
Reputation:
You are looking for the QWebPage::javaScriptAlert ( QWebFrame * frame, const QString & msg )
function:
This function is called whenever a JavaScript program running inside frame calls the alert() function with the message msg.
The default implementation shows the message, msg, with QMessageBox::information.
Upvotes: 3