WebFile object and WinToolBar object - need VBScript to Upload a file into website.

1,966 views
Skip to first unread message

Rekha

unread,
Nov 28, 2012, 3:06:19 PM11/28/12
to qtp-ele...@googlegroups.com

I am not able to upload a file after selecting Browse button. QTP is able to recognize the browse button but it is not recognizing the path give to upload a file. is there any way for QTP to recognize the path an upload the file provided in the path… during recording or using vbscripting/descriptive programming.

 

I googled I tried using this object in several different ways, but its not working properly. Can you please see my code below and let me know? How to use WebFile object and WinToolBar object, please let me know if you know.

 

oPg1.WebFile("upload photo").Click

‘choose file to upload dialog opens…

If Browser("Coffee").Dialog("Choose File to Upload").Exist Then

Reporter.ReportEvent micPass,"Choose File to Upload - Dialog box opened"," "

‘Browser("Coffee").Dialog("Choose File to Upload").WinToolBar("Address: Desktop").Set "C:\Users\xyz\Test Data"   ????

                Browser("Coffee").Dialog("Choose File to Upload").WinToolBar("Address: Desktop").Press  "C:\Users\xyz\Test Data"  ????

                Browser("Coffee").Dialog("Choose File to Upload").WinEdit("File name:").Set "sample Upload photo.jpg"

                Browser("Coffee").Dialog("Choose File to Upload").WinButton("Open").Click

Else

                Reporter.ReportEvent micFail,"Choose File to Upload - Dialog box NOT opened"," "

End If

 

 

 

Thank you!

Rekha

Rajesh

unread,
Nov 29, 2012, 3:14:13 AM11/29/12
to Rekha, qtp-ele...@googlegroups.com
are u doing this on any openly available website? if so, what is the site?

--
You received this message because you are subscribed to the Google Groups "QTP eLearn Team" group.
To unsubscribe from this group, send email to qtp-elearn-te...@googlegroups.com.
Visit this group at http://groups.google.com/group/qtp-elearn-team?hl=en-US.
 
 

Rajesh

unread,
Nov 29, 2012, 3:27:08 AM11/29/12
to Rekha, qtp-ele...@googlegroups.com
oPg1.WebFile("upload photo").Click' i dont think this will be WebFile object.
It should be a link or button.
 
Browser("Coffee").Dialog("Choose File to Upload").WinToolBar("Address: Desktop").Set "C:\Users\xyz\Test Data" 
this lines is ok. it puts the path of the file into the text box. keep the extension of the path of the file too. .xls or.doc . This includes cliking open too. so there is no need to click open.
 
after this then if there is a button like upload photo or something like that...click on it. it shud work.
 


On Thu, Nov 29, 2012 at 1:36 AM, Rekha <rnr...@gmail.com> wrote:

--
Reply all
Reply to author
Forward
0 new messages