Selenium RC > how to upload file using attachFile()

后端 未结 8 761
谎友^
谎友^ 2021-02-04 14:02

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:/         


        
8条回答
  •  醉梦人生
    2021-02-04 14:26

    "fileLocator" is not an url but a locator as specified at top in the javadoc of the Selenium class. It is the locator of the input used to select a file.

    The "fieldLocator" is an url pointing to the file you want to set in the input field of the form, as specified in the doc you are quoting.

    With Firefox in chrome mode (browserId=*chrome instead of *firefox), this works as expected. It is documented to be working only with this browserId)

    For instance : attachFile("uploadField", Thread.currentThread().getContextClassLoader().getResource("files/sample.pdf").toString());

提交回复
热议问题