Selenium RC > how to upload file using attachFile()

Posted by Saara on Stack Overflow See other posts from Stack Overflow or by Saara
Published on 2009-11-10T13:13:53Z Indexed on 2010/03/21 9:21 UTC
Read the original article Hit count: 661

Filed under:
|

hello,

I am using Selenium RC with Junit framework. I am trying to upload a file using attachFile() method.

attachFile: (Information collected from selenium API http://release.seleniumhq.org/selenium-remote-control/1.0-beta-2/doc/java/com/thoughtworks/selenium/Selenium.html#attachFile(java.lang.String,%20java.lang.String))

void attachFile(java.lang.String fieldLocator,
            java.lang.String fileLocator)

Sets a file input (upload) field to the file listed in fileLocator

Parameters:
    fieldLocator - an element locator
    fileLocator - a URL pointing to the specified file. Before the file can be set
  in the input field (fieldLocator), Selenium RC may need to transfer the file to 
  the local machine before attaching the file in a web page form. This is common in 
  selenium grid configurations where the RC server driving the browser is not the 
  same machine that started the test. Supported Browsers: Firefox ("*chrome") only.

Can anyone please tell me how to define "fileLocator". I am not getting which URL to be specify over here. Please give me an example if possible.

© Stack Overflow or respective owner

Related posts about selenium-rc

Related posts about JavaScript