Micro Focus QTP (UFT) Forums

Full Version: Unable to select WebFile element
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Dear All,

When i try to take spy for Browse button it select whole text of logofilename & browse button together, i am unable to take spy for separate Browse button. I write descriptive programming for click on Browse button but i am unsuccessfull, Can anybosy just let me know how would i click on Browse so it open a window to select(Browse) file.

My code is:

Code:
Public Function ClickBrowseWebFile()

Dim NumberOfEdits, webElementToSearch
webElementToSearch="bannerlogo"
Set oDesc = Description.Create
oDesc("html tag").Value = "INPUT"
oDesc("micclass").Value = "WebFile"
oDesc("name").Value = "bannerlogo"

Set EditCollection = Browser("title:=Publish").Page("title:=Publish.*").ChildObjects(oDesc)

NumberOfEdits = EditCollection.Count
MsgBox(NumberOfEdits)

For i = 0 To NumberOfEdits - 1
    If EditCollection(i).GetROProperty("name") = webElementToSearch Then
      EditCollection(i).Click
    End If

Next

End Function

Please help me out, hoping for cooperation

Thanks

Mahesh
Hello All,

I got the solution,need for some setting

1. Select Tools>>Web Event Recording Configuration>>Custom Settings

2. On the left hand side, select WebFile in the Standard Web Objects branch of the Objects pane

3. Select Event>>Add>>onclick

4. Select Always in the Listen column for this event

good luck Smile


Thanks

Mahesh
Hi,
In this situation "Logo File Name" is acting as Edit field so automatically whatever the file name u specified which is using that and pefroming the action this is the default behavior of these kind of Browse buttions

Regards,
Venkat.Batchu
Hello Venkat/All,

I got the solution,need for some setting

1. Select Tools>>Web Event Recording Configuration>>Custom Settings

2. On the left hand side, select WebFile in the Standard Web Objects branch of the Objects pane

3. Select Event>>Add>>onclick

4. Select Always in the Listen column for this event

good luck


Thanks

Mahesh
Instead of clicking on browse button you can specify the file path to be selected
Code:
Browser("XXX").Page("XXX").WebFile("Filebrowser").Set "c:\a1.txt"
The file would get set to the fileld
(12-03-2009, 09:34 AM)upadhyay40 Wrote: [ -> ]Hello Venkat/All,

I got the solution,need for some setting

1. Select Tools>>Web Event Recording Configuration>>Custom Settings

2. On the left hand side, select WebFile in the Standard Web Objects branch of the Objects pane

3. Select Event>>Add>>onclick

4. Select Always in the Listen column for this event

good luck


Thanks

Mahesh

I've also done this setting in UFT_12.02, but even I got same problem.
Please help.
I've also done this setting in UFT_12.02, but even I got same problem.
Please help.