Since Rad Uploader is basically a Java Applet, you could use LiveConnect to interact with it!
There is even a tool for it and Selenium (though I'm not using it, so I can't tell whether it works well or not): http://fest.codehaus.org/Selenium
If it doesn't work, then you'll probably need to use a different automation library to upload the files, because Selenium is not built to work neither with Java applet, nor outside the browser. Possible solutions include drag'n'dropping or (Ctrl+C + Ctrl+Ving) the files from outside the window to your Uploader, or clicking blindly on the Browse button...
Edit
I was obviously looking at the wrong product, because OP's code shows it's actually a Silverlight element, not a Java applet.
But - knowing that there's a tool for this for Java applets, I digged and found these:
There is a tool for using Selenium RC with Silverlight! No idea how well it actually works, but you could give it a try. Yes, I know it's only Selenium RC, but you could try it with WebDriverBackedSelenium
...
Scott Hanselman's blog (very readable!) - "abusing" that Silverlight can run Scriptable
methods. It is written for Selenium IDE, but the same will work for WebDriver
, too.
A testing framework for Silverlight. By Microsoft. Selenium is for webpages, try this for some Silverlight magic.
EDIT 2:
There's always the option I mentioned earlier. Since the upload thing is no input
, but a Silverlight object and there's no API for WebDriver that would allow you to work with browser dialogs (or Silverlight objects), you can try this:
After you click the Silverlight element, there'll be a window popping up that you'll have no control over. In the browsers and operating systems I know, you can pretty much assume that after the window has been opened, the cursor is in the File name
input. Please, make sure this assumption is true in your case, too.
If not, you could try to jump to it by pressing Alt + N, at least on Windows...
(Java code follows! I really don't know C#. It works in Java, though. C#'s class that is similar to Java's Robot
is SendKeys
)
If yes, you can "blindly" type the path into it using the Robot
class. In your case, that would be something in the way of:
driver.findElement(By.id("SWFUpload_0")).click();
Robot r = new Robot();
r.keyPress(KeyEvent.VK_C); // C
r.keyRelease(KeyEvent.VK_C);
r.keyPress(KeyEvent.VK_COLON); // : (colon)
r.keyRelease(KeyEvent.VK_COLON);
r.keyPress(KeyEvent.VK_SLASH); // / (slash)
r.keyRelease(KeyEvent.VK_SLASH);
// etc. for the whole file path
r.keyPress(KeyEvent.VK_ENTER); // confirm by pressing Enter in the end
r.keyRelease(KeyEvent.VK_ENTER);
It sucks, but it should work. Note that you might need these: How can I make Robot type a `:`? and Convert String to KeyEvents