Micro Focus QTP (UFT) Forums
DOM: Set value - INPUT element of type file - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: DOM: Set value - INPUT element of type file (/Thread-DOM-Set-value-INPUT-element-of-type-file)



DOM: Set value - INPUT element of type file - thutib - 07-07-2008

Hi,

I am trying to set a value to an INPUT element of type=file, but it fails as its a read only property.
ele.value = "C:\abc.xml"
Note:- ele is the element I read using DOM Methods..

Using QTP "WebFile" method "Set", am able to set this value.
How is this designed!
____
Below is the line from page source of a web page:-
Code:
<input id="uploadFile" type="file" name='uiBean.evt.fullPath' value="" size="70" />

Using DOM I read this element & stored in a variable named ele.
ele.value = "C:\abc.txt"

This Fails!

But I am able to populate from QTP as below simple as below:-
Code:
Browser("dddd").Page("sddd").WebFile("UploadFile").Set "C:\abc.txt"

Now:-
I wanna populate this field using DOM or any other Object Model but not using QTP given WebFile/WebEdit Methods.

This should be possible in someway because QTP WebFile Method "Set" is also developed based on some library.

Note:-
value property of this element(INPUT Tag with type=file) is read-only. (http://www.w3schools.com/htmldom/dom_obj_fileupload.asp)


Can anyone please help me to resolve this issue.
For now I am managing with sendkeys method, which I want to remove.

Thanks,
Bapu