0

I'm willing to write an automated test in Selenium WebDriver + JUnit that drops a local file into a drag & drop area of the browser. I've looked at the html code, but there's no input area where I could inject the local path to my file.

I've found some interesting resources :

But none of these are appropriate for my special case. Can someone help?

Thank you.

Community
  • 1
  • 1

2 Answers2

0

Selenium WebDriver can't interact with anything outside of the browser. What you need is something like java's Robot class or something like sikuli.

Simple drag and drop example with robot:

Robot robot = new Robot ();
robot.mouseMove(350, 350);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseMove(250, 350);
robot.mouseRelease(InputEvent.BUTTON1_MASK);

There may also be a way to insert your path via javacsript.

user2272115
  • 986
  • 1
  • 10
  • 22
0

Thank you for your kind answer. I tried the Robot class this morning, but it wasn't able to cope with local files. I eventually found this video, and I'm now working my problem out. Fortunately AutoIt (which is a little bit like Sikuli I guess) can be plugged in Selenium. Thanks anyway!