File Upload in drop zone

Hello,
I am new to robot framework.
I want to upload one file from my system in python modal pop up.
There is no input tag and hence choose file is not working.
I use autoit library but facing some other issue there. Some time it locates the path through autoit and sometime is doesnt.
Please guide is the there any way to use choose file for dropzone.

Usually there is an input tag of type="file". The trick is not to activate any button for the browser or operating system file locator dialog. If you are activating a “Drop files here” area, then you can still activate it with Mouse Over and then use the Choose File keyword. Using Dev Tools on Chrome will help to find the correct input field.
Good luck.

1 Like

Hi,
I tried in many ways but its not working.
I used autoit library but it is giving an error with not valid file name.

Can you use Ctrl-F on Chrome’s dev tools, and search with //input[@type='file'] when you are on that page, and before clicking any element that would call the file upload?

1 Like

AFAIK, dropzone uses Drag’n’Drop events to get the file from local filesystem into dom before the actual upload is triggered and sadly there is no support for triggering those events via SeleniumLibrary at this time. However, adding support for that sort of feature is’t that hard. Working python code can be copied from https://stackoverflow.com/questions/43382447/python-with-selenium-drag-anda-drop-from-file-system-to-webdriver

Ps. This feature will land into SeleniumTestability soonish …

1 Like

And the feature has been added/released to SeleniumTestability 1.1.0, keyword docs: https://rasjani.github.io/robotframework-seleniumtestability/index.html?tag=plugin#Drag%20And%20Drop

2 Likes

When using Selenium Library version 4.0.0b3 I am getting the follow error below, yet when using version 3.141.0 it will run successfully. We installed the latest version of Selenium to test against Edge browser. Do you have a fix for this?

[ ERROR ] Error in file ‘C:\GIT\Repos\Eclipse\UPEnterprise_Robot\tests\Regressions\UPExchange\UPXREGEditProperties.robot’ on line 2: Initializing library ‘SeleniumLibrary’ with arguments [ plugins=SeleniumTestability;False;5 Seconds;True ] failed: Importing test library ‘SeleniumTestability’ failed: AttributeError: type object ‘DesiredCapabilities’ has no attribute ‘PHANTOMJS’
Traceback (most recent call last):
File “C:\AppData\Local\Programs\Python\Python37\lib\site-packages\SeleniumTestability_init_.py”, line 2, in
from .plugin import SeleniumTestability
File “C:\AppData\Local\Programs\Python\Python37\lib\site-packages\SeleniumTestability\plugin.py”, line 43, in
class SeleniumTestability(LibraryComponent):
File “C:\AppData\Local\Programs\Python\Python37\lib\site-packages\SeleniumTestability\plugin.py”, line 148, in SeleniumTestability
“phantomjs”: DesiredCapabilities.PHANTOMJS,
PYTHONPATH:
C:\GIT\Repos\Eclipse\UPEnterprise_Robot
C:\AppData\Local\Programs\Python\Python37\python37.zip
C:\AppData\Local\Programs\Python\Python37\DLLs
C:\AppData\Local\Programs\Python\Python37\lib
C:\AppData\Local\Programs\Python\Python37
C:\AppData\Roaming\Python\Python37\site-packages
C:\AppData\Local\Programs\Python\Python37\lib\site-packages

It is called thread hijacking, using an existing topic to talk about a different one/question.

(the first thing you should have done, would be to test again with updated versions of the libraries)

We are using this for Drag and Drop, but ok I’ll ask the question in new thread.