Autocomplete dropdown list not displayed with qtp for webedit (3326 Views)
Reply
Occasional Visitor
Ah_12
Posts: 3
Registered: ‎06-11-2013
Message 1 of 9 (3,326 Views)

Autocomplete dropdown list not displayed with qtp for webedit

I have a problem in my web application automation with qtp. QTP is setting value in the Edit box. But drop down list is not displayed while doing with QTP. If we are trying manually then list is getting displayed.

the properties for WebEdit object are

"Class Name:=WebEdit",
"abs_x:=772",
"abs_y:=636",
"class:=ui-autocomplete-input",
"default value:=",
"disabled:=0",
"height:=20",
"html id:=alertTextTag",
"html tag:=INPUT",
"innerhtml:=",
"innertext:=",
"kind:=singleline",
"max length:=2147483647",
"name:=alertTextTag",
"outerhtml:=<INPUT aria-haspopup=true id=alertTextTag class="ui-autocomplete-input" role=textbox size=45 type=text name=alertTextTag autocomplete=""off"" jQuery171016074769097226676=""73"" aria-autocomplete=""list"">",
"outertext:=",
"readonly:=0",
"rows:=0",
"type:=text",
"value:=",
"visible:=True",
"width:=288",
"width in characters:=45",
"x:=388",
"y:=487"

 

Manually ,After clicking the webedit box when we press the down arrow, dropdown list is displayed .I tried to do the exactly same in qtp script by SendKey method with following code

 

Set WshShell = CreateObject("WScript.Shell")
Browser("BrowserName").Page("PageName").WebList("searchForAlertBy").Select "Alert Category"
Browser("BrowserName").Page("PageName").WebEdit("alertTextTag").Set "Assets"

Browser("BrowserName").Page("PageName").WebEdit("alertTextTag").Click
Wscript.Sleep 100
WshShell.SendKeys "{DOWN}"

 

But Down key is not pressed on application.

What is wrong with this code and is there any other method to achieve this?

 

Thanks

 

 

 

 

 

 

 

 

 

Please use plain text.
Valued Contributor
Anshoo_Arora
Posts: 82
Registered: ‎07-06-2011
Message 2 of 9 (3,316 Views)

Re: Autocomplete dropdown list not displayed with qtp for webedit

[ Edited ]

try this:

 

Browser("BrowserName").Page("PageName").WebList("searchForAlertBy").Select "Alert Category"
Browser("BrowserName").Page("PageName").WebEdit("alertTextTag").Click

Set WshShell = CreateObject("WScript.Shell")

With WshShell
    .SendKeys "Assets" : Wait(1)
    .SendKeys "{DOWN}"
End With

 

*EDIT:  I have only modified your code above.  Let me know if it works.  Fyi, there are better ways to achieve this by using the generated DOM once a value is entered.   For example, you can test this code on Google which will retrieve all possible choices generated once "Assets" is entered.

 

Dim td, ix

With Browser("title:=.*Google.*")
    .WebEdit("name:=q").Set "Assets"
    Set td = .WebTable("class:=gssb_m").Object.getElementsByTagName("span")
End With

For ix = 0 To td.length - 1
    MsgBox td.item(ix).innerText
Next

 


--
Anshoo Arora
Relevant Codes
LinkedIn
Please use plain text.
Occasional Visitor
Ah_12
Posts: 3
Registered: ‎06-11-2013
Message 3 of 9 (3,303 Views)

Re: Autocomplete dropdown list not displayed with qtp for webedit

Thanks Anshoo for reply

 

I tried with your edited code.but its not working on applciation.

Not entring the text "Assets" in edit box and not pressing the down key.Is there something else i can try.

 

I tried your second set of code.It work fine on google but on my application dropdown is not weblist.Those are the webelements under page.

And application is developed in such a way tht only when you select by clicking the dropdown list next action happens.Getting the text from dropdown list and then setting  the edit text doesn't serves the purpose.So i  guess i really need to have the SendKey method working.

 

Thanks,

 

Please use plain text.
Valued Contributor
Anshoo_Arora
Posts: 82
Registered: ‎07-06-2011
Message 4 of 9 (3,296 Views)

Re: Autocomplete dropdown list not displayed with qtp for webedit

Can you share an example of this object?


--
Anshoo Arora
Relevant Codes
LinkedIn
Please use plain text.
Occasional Visitor
Ah_12
Posts: 3
Registered: ‎06-11-2013
Message 5 of 9 (3,293 Views)

Re: Autocomplete dropdown list not displayed with qtp for webedit

This is the object descrition example for the dropdown list

 

"Class Name:=WebElement",
"abs_x:=772",
"abs_y:=656",
"class:=ui-autocomplete ui-menu ui-widget ui-widget-content ui-corner-all",
"height:=144",
"html id:=",
"html tag:=UL",

"innerhtml:=<LI class="ui-menu-item" role=menuitem jQuery171016074769097226676=""159""><A style=""CURSOR: pointer"" class="ui-corner-all" tabIndex=-1 jQuery171016074769097226676=""165""><SPAN class="golden">A</SPAN>ssets - AS0100 - \[XXXX\]</A></LI><LI class="ui-menu-item" role=menuitem jQuery171016074769097226676=""163""><A style=""CURSOR: pointer"" class="ui-corner-all" tabIndex=-1 jQuery171016074769097226676=""169"">Occup<SPAN class="golden">a</SPAN>ncy - OC0100 - \[XXXX\]</A></LI><LI class="ui-menu-item" role=menuitem jQuery171016074769097226676=""164""><A style=""CURSOR: pointer"" class="ui-corner-all" tabIndex=-1 jQuery171016074769097226676=""170"">Origin<SPAN class="golden">a</SPAN>ting Lender - OR0100 - \[XXXX\]</A></LI>",
"innertext:=Assets - AS0100 - \[XXXX\]abilities - LI0100 - \[XXXX\]Occu - OC0100 - \[XXXX\]Originate - OR0100 - \[XXXX\]",
"outerhtml:=<UL style=""Z-INDEX: 1007; WIDTH: 282px; DISPLAY: block; TOP: 507px; LEFT: 388px"" class=""ui-autocomplete ui-menu ui-widget ui-widget-content ui-corner-all"" role=listbox aria-activedescendant=ui-active-menuitem jQuery171016074769097226676=""146""><LI class="ui-menu-item" role=menuitem jQuery171016074769097226676=""159""><A style=""CURSOR: pointer"" class="ui-corner-all" tabIndex=-1 jQuery171016074769097226676=""165""><SPAN class="golden">A</SPAN>ssets - AS0100 - \[XXXX\]</A></LI><LI class="ui-menu-item" role=menuitem jQuery171016074769097226676=""162""><A style=""CURSOR: pointer"" class="ui-corner-all" tabIndex=-1 jQuery171016074769097226676=""168"">Li<SPAN class="golden">a</SPAN>bilities - LI0100 - \[XXXX\]</A></LI><LI class="ui-menu-item" role=menuitem jQuery171016074769097226676=""163""><A style=""CURSOR: pointer"" class="ui-corner-all" tabIndex=-1 jQuery171016074769097226676=""169"">Occup<SPAN class="golden">a</SPAN>ncy - OC0100 - \[XXXX\]</A></LI><LI class="ui-menu-item" role=menuitem jQuery171016074769097226676=""164""><A style=""CURSOR: pointer"" class="ui-corner-all" tabIndex=-1 jQuery171016074769097226676=""170"">Origin<SPAN class="golden">a</SPAN>ting Lender - OR0100 - \[XXXX\]</A></LI></UL>",
"outertext:=Assets - AS0100 - \[XXXX\]abilities - LI0100 - \[XXXX\]Occu - OC0100 - \[XXXX\]Originate - OR0100 - \[XXXX\]",
"type:=",
"visible:=True",
"width:=288",
"x:=388",
"y:=507"

 

Thanks

Please use plain text.
Occasional Visitor
AjayBongane
Posts: 1
Registered: ‎11-20-2013
Message 6 of 9 (2,413 Views)

Re: Autocomplete dropdown list not displayed with qtp for webedit

Does anybody get the solution. I am also facing the same issue.

Please use plain text.
HP Expert
Ana_Noncheva
Posts: 245
Registered: ‎08-06-2013
Message 7 of 9 (2,264 Views)

Re: Autocomplete dropdown list not displayed with qtp for webedit

Hello,

 

UFT provides support for some JQuery objects (widgets) but, unfortunately, Autocomplete is not amongst them.

 

(Note: You can install JQuery support from <UFT installation disk>\Extensibility and Toolkits\Web2AddinSetup, which provides support for following jQ UI widgets:

Accordion, Datepicker, List, Slider, Tabs, ToggleButton)

 

You can submit ER for Autocomplete here (* with your SAID): https://support.openview.hp.com/casemanager/newincident?requestTypeId=enhancement-request

 

Anshoo's suggestion with SendKeys is working for me against this sample Autocomplete: http://jqueryui.com/autocomplete/

Can you test it there? What is the outcome?

Maybe you should add one additional WebEdit.Click line?

Or, record the Click in Low Level?

 

Let me know the outcome.

 

Regards,

Ana

 

“HP Support
If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.”
Please use plain text.
Occasional Visitor
Vivekraj123
Posts: 2
Registered: ‎05-26-2014
Message 8 of 9 (1,017 Views)

Re: Autocomplete dropdown list not displayed with qtp for webedit

Thanks a lot anshoo....your first method works like charm :)

Please use plain text.
Occasional Visitor
Jeremy2000
Posts: 3
Registered: ‎09-30-2011
Message 9 of 9 (927 Views)

Re: Autocomplete dropdown list not displayed with qtp for webedit

[ Edited ]

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 pass the value to your function and read from datatable

Please use plain text.
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