Reputation: 51
I need to enter a filepath to upload a file in a windows pop-up, How to handle it in selenium+python+robot framework?
Upvotes: 1
Views: 1475
Reputation: 20057
Specifically for file uploads, one does not open the OS dialog and enter the path there. If you did make it work somehow, then it would be specific for Windows; but what if the case is ran on Mac OS? Or headless Linux?
For this purpose in Selenium there's a special method, available in SeleniumLibrary as the Choose File keyword. Through it the full path is set as the value of the input
element handling the upload, and no OS modal is brought up.
Selenium even has some special code to transfer the file, if the browser is a remote one (e.g. the file is local for the execution machine, but the browser is running on a different, remote one).
Upvotes: 2