Unified Functional Testing Practitioners Forum
Showing results for 
Search instead for 
Do you mean 

QTP : Issue with selecting a value(webelement) from weblist

Occasional Visitor

QTP : Issue with selecting a value(webelement) from weblist

Hi,

Our application uses the WebElement ( drop down list box) and QTP does not seem to record that at all .
The Hirearchy is as follows ,
To set the value in Webedit(in readonly mode), we have to select a value from the list which is displayed only after clicking the Image(Expand).
The values in weblist are built as webelements which cannot be viewed from Object Spy .
I have tried descriptive programming and could identify the properties of webelements in the list.

But the problem is , I am not able to select the value(webelement).

Set ListElmt = Description.Create()
ListElmt("micclass").Value = "WebElement"
Set LstElmt1 = LstElmt.ChildObjects(ListElmt)
LstElmt1(1).FireEvent "ondblclick"

And also tried ,
Browser("Home").Page("Page").WebElement("innertext:=BUSINESS CLASS DOMESTIC ONLY" , "index:=1").FireEvent "ondblclick"

Is there a way to select the drop down value from a WebElement ?

Thanks,
Jyotsna

6 REPLIES
Occasional Visitor

Re: QTP : Issue with selecting a value(webelement) from weblist

To Add More information , The HTML tag of the Webelement is set as "OPTION"
Occasional Advisor

Re: QTP : Issue with selecting a value(webelement) from weblist

Hi,

try this let us know

you have to click the webedit first,then only the object get visible

Set ListElmt = Description.Create()
ListElmt("micclass").Value = "WebElement"
ListElmt("html tag").value="get the value from object spy"

Browser("browser").page("page").Frame("frame').Webedit("webedit").click

Set obj=Browser("browser").page("page").Frame("Frame").webelement(ListElmt).click
Occasional Advisor

Re: QTP : Issue with selecting a value(webelement) from weblist

[ Edited ]

Hi , I am also facing same issue but dropdown values are links rather than webelement.

To set the value in Webedit(in readonly mode), we have to select a value from the list which is displayed only after clicking the Image(Expand).
The values in weblist are built as links which cannot be viewed from Object Spy .
I have tried descriptive programming and but unable to slect any value in dropdown.

 

Please reply.

 

Occasional Visitor

Re: QTP : Issue with selecting a value(webelement) from weblist

Try using Wscript SendKey as in sample below

 

dim WshShell 

 

Browser("<browser name>").Page("<page name>").WebElement("<name>").Click

Set WshShell = CreateObject("WScript.Shell")


        WshShell.SendKeys "{DOWN}",True

        WshShell.SendKeys "{ENTER}"

Occasional Visitor

Re: QTP : Issue with selecting a value(webelement) from weblist

Set WshShell = CreateObject("WScript.Shell")    
    opNum = 0
    Do
        opNum = opNum + 1
        
        Browser("IAS").Page("IAS").WebElement("AType").Click
                 
        With WshShell
            .SendKeys "{DOWN}"
            .SendKeys "{ENTER}"
        End With
    Loop Until (Browser("IAS").Page("IAS").WebEdit("AType").GetROProperty("value")="Other" or opNum > 23)
     
Set WshShell = Nothing 

 

Note:= "Other" can be replace by datatable. Pass the value to function.

Occasional Visitor

Re: QTP : Issue with selecting a value(webelement) from weblist

Hi I am able to select the drop down values but the problem is when i want to update the data in the field then i am facing problem . First we need to clear the field then we can use send keys to select new value. So please can u help on how to clear the field.