File upload is already supported in Firefox with *chrome mode. Here, we're extending this support to grid environments. Before a file can be set in the input field of a web form, Selenium RC may need to transfer the file to the local machine before attaching the file to a web page form. This is common in selenium grid (aka "hub and spoke") configurations where the remote control driving the browser is not the same machine that started the test.
Supported Browsers: Firefox ("*chrome") only. Other browser supported later.
Usage:
selenium.attachFile("<locator_of_file_element_on_page>", "<file_URL>")
Example:
selenium.attachFile("id=file_attachment_field", "
http://www.bigcorp.com/~employee1/myfile.jpg")
Selenium RC on the local machine will download the file from <file_URL>, save the file to a temp directory, and then set the file element locator to the correct path. Once the session ends, the temp file will be deleted from the local system.
There are certainly other methods for transferring the file: 1) shared network drive via either NFS or WebDav, or 2) FTP. But for simple cases, this works well, since we know the Remote Control machine will have access to port 80. If the user exposes the file to be downloaded on a public (or intranet) web server, transferring the file to the machine is as simple as GETing the file's URL and saving the stream to disk.