QTP : Issue with selecting a value(webelement) from weblist (5962 Views)
Reply
Occasional Visitor
Jyotsna Reddy
Posts: 2
Registered: ‎01-29-2011
Message 1 of 6 (5,962 Views)

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

Occasional Visitor
Jyotsna Reddy
Posts: 2
Registered: ‎01-29-2011
Message 2 of 6 (5,939 Views)

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
Dharani_S
Posts: 8
Registered: ‎01-10-2011
Message 3 of 6 (5,939 Views)

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 Visitor
manudua
Posts: 1
Registered: ‎09-04-2012
Message 4 of 6 (5,257 Views)

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
jasrar
Posts: 2
Registered: ‎02-21-2014
Message 5 of 6 (1,807 Views)

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
Jeremy2000
Posts: 3
Registered: ‎09-30-2011
Message 6 of 6 (1,479 Views)

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.

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.