Quantcast
Channel: Qt DevNet forums: Qt WebKit
Viewing all articles
Browse latest Browse all 542

Bug? Choose file dialog sometimes opens instead of QWebPage.chooseFile call

$
0
0
I emulate clicking file upload button with events, to automate this action. Code of mouse click: # el - upload button el_pos = el.geometry().center() self._page.mainFrame().setScrollPosition(el_pos) scr_pos = self._page.mainFrame().scrollPosition() point_to_click = el_pos - scr_pos   press = QMouseEvent(QMouseEvent.MouseButtonPress, point_to_click, Qt.LeftButton, Qt.LeftButton, Qt.NoModifier) release = QMouseEvent(QMouseEvent.MouseButtonRelease, point_to_click, Qt.LeftButton, Qt.LeftButton, Qt.NoModifier) QApplication.postEvent(self._handler, press) QApplication.postEvent(self._handler, release) Then I handle file choosing with QWebPage.chooseFile function, and in very trivial cases it works as expected. But on many sites after mouse click system choose file dialog [sec.yimg.com] opens (even if QWebView is hidden). Is it a bug? Is there more correct way to automate file upload button handling? I’m using PyQt5.2.1, Windows 7 ×86

Viewing all articles
Browse latest Browse all 542

Trending Articles