pythonqtpyqt4qwebviewqfiledialog

Qt: Take over system open file dialog


I would like to automate the upload of a file to a website using PyQt4's QWebView, but there's a part I can't figure out yet. To upload the file, the website has a button, which opens a dialog from which you are supposed to select the local file. So, these are my questions :) Is there a way to control that dialog once I click the button? Is there a better way to achieve this?

edit

The website is https://maps.google.com/ and I'm uploading a .kml file through My Places > Create Map > Import.


Solution

  • It is possible what you're looking for is QWebPage::chooseFile() (I suppose it depends also on how the website is handling that). Reimplement that and see if it is sufficient. Do whatever you want and return the chosen file path.

    EDIT: Now that you provided the link I tested and seems to work.