0

I'm writing watin test and I have to upload file for mvc control but watin don't recognize mvc upload control.

here is the silverlight code:

<object type="application/x-silverlight-2" data="data:application/x-silverlight-2," id="ContentPlaceHolder1_ASPxUploadControl1_TextBox0_SLUploadHelper" width="70px" height="22px" style="position: absolute; background-color: transparent; top: -5000px; opacity: 0.01; left: 75px;" class=" ContentPlaceHolder1_ASPxUploadControl1_dxFITextBoxHover" title=""><param name="source" value="/DXR.axd?r=1_1-C5nV6"><param name="background" value="Transparent"><param name="windowless" value="true"><param name="minRuntimeVersion" value="3.0.40818.0"><param name="initParams" value="controlName=ContentPlaceHolder1_ASPxUploadControl1, inputIndex=0, multiselect=true, allowedMaxFileSize=4194304, allowedFileExtensions=.jpg;.jpeg;.jpe;.gif;.png, filter=*.jpg;*.jpeg;*.jpe;*.gif;*.png"><param name="onLoad" value="slOnLoad_ContentPlaceHolder1_ASPxUploadControl1_TextBox0_SLUploadHelper"><param name="onError" value="slOnError_ContentPlaceHolder1_ASPxUploadControl1_TextBox0_SLUploadHelper"></object>

the problem is here , silverlight upload control is an object and watin don't know how to convert it to FileUpload. what should I do for control a silverlight UploadFile with WatiN.

4

1 回答 1

0

Watin is a framework which provides typed access to the HTML of a page. It cannot work with client plugins like Silverlight and Flash. It cannot convert the Silverlight object to a FileUpload because it IS NOT a file upload. It is an <object> tag in the HTML.

You have to use another framework, which supports Silverlight. More information in this question: Silverlight Automation Similar to Watin

于 2013-08-29T11:28:25.617 回答