Drag an item from windows directory and drop it in selenium browser window

139 views
Skip to first unread message

Musaffir Lp

unread,
Nov 13, 2015, 5:43:33 AM11/13/15
to Selenium Users
Hi All,

I have this requirement ...
I have an item in my local directory of windows os , i want to drag this item and wanted to drop it in the browser opened by selenium webdriver...
can we do this by any way ? i know we have Action class supporting the drag and drop of web elements with in the browser...

but my requirement is bit different...here the source is a file present in the window local dir.....and dropping destination is browser launched by the selenium web driver...
Please let me know if you have automated this a,or aware of any idea which i can try...

Thanks & Warm Regards
Musaffir

Musaffir Lp

unread,
Nov 13, 2015, 5:44:57 AM11/13/15
to Selenium Users
Basically these actions are required to upload the file which i am dragging and dropping....this is how the file uploads works in the application....

PeterJeffreyGale

unread,
Nov 13, 2015, 6:01:00 AM11/13/15
to Selenium Users
Have the dev's written any code to specifically support this in a way that is any different from just sending the file path to the target element?

Musaffir Lp

unread,
Nov 15, 2015, 9:51:22 PM11/15/15
to Selenium Users
Hi Peter,

Yes,they have written it in this way...and that is the requirement....dragging a file from os local directory and dropping it to the web page,it should prompt the upload process...

PeterJeffreyGale

unread,
Nov 16, 2015, 3:22:07 AM11/16/15
to Selenium Users
Then if it is more than the standard HTML file upload functionality, I think we will need to see their code for doing this before anyone can make a suggestion as to what you can do to test it effectively.

Musaffir Lp

unread,
Nov 16, 2015, 3:53:15 AM11/16/15
to Selenium Users
Actually they have both way of uploading the file ...
one by the standard html file upload functionality,clicking a browse button to choose a file from local dir ,then uploading it and another by this drag and drop any item to any part of the web page..

PeterJeffreyGale

unread,
Nov 16, 2015, 4:05:35 AM11/16/15
to Selenium Users
So, show us the code they have written for each.

Webdriver cannot do anything outside the browser window, so I think you need to show us the specific developer code that has been written for this in the web page in question so that we can see that acting outside the browser window is a definite requirement to test what has been written,and so that someone might be able to make suitable alternative suggestions for your needs.

However, just as webdriver cannot act outside the browser window, so far as I am aware, neither can the code in a web page (without gaining your explicit permission to do so) so I am not convinced yet that you really need anything more than sending the file path to the html input element.

If you can't provide more detail then you might want to look at tools like java robot or sikuli ... but you might just be expending effort unnecessasarily there.
Reply all
Reply to author
Forward
0 new messages