Highlighted
Contributor.
Contributor.
602 views

How to open a WebList

Hello everyone, 

we are creating an automated test and we would ask you for help on a "particular" kind of WebList. We have to select an element from a WebList that is open after writing the first letters and that suggests us the possible corresponding choices.  What technique could I adopt to insert this instruction? Could you help me, please? For further information, I will attach a screen shot down below. Thanks.

Kind regards

0 Likes
7 Replies
Highlighted
Knowledge Partner
Knowledge Partner

Re: How to open a WebList

Do you want to select a specific town such as 'Roana (Vi)' or  select a random town?

Specific you can  do something like:

 

Browser("X").Page("Y").WebEdit("Z").Set "ro"
Browser("X").Page("Y").WebList("A").Select "Roana (Vi)"

To select a random town:

Browser("X").Page("Y").WebEdit("Z").Set "ro"
townCount = Browser("X").Page("Y").WebList("A").GetROProperty(items count"")
rand = RandomNumber (0,townCount - 1) 
townCount = Browser("X").Page("Y").WebList("A").Select '#'&rand

Mark Smith.

0 Likes
Highlighted
Contributor.
Contributor.

Re: How to open a WebList

Thank you for answering. I have to select a specific town, but the fact is that the weblist opens while you are editing the name and UFT doesn't do the set instruction and doesn't select the town from the list.

0 Likes
Highlighted
Knowledge Partner
Knowledge Partner

Re: How to open a WebList

Have you tried recording in low-level or Analogue recording mode?

Mark Smith.

0 Likes
Highlighted
Contributor.
Contributor.

Re: How to open a WebList

Yes, I have, but it works only few times and then a message of error occurs

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: How to open a WebList

Martina,

Have you tried looking into the Web Event Recording Configuration options (https://admhelp.microfocus.com/uft/en/latest/UFT_Help/Content/Addins_Guide/Event_Listen_Rec_Use-Case_Scenario.htm)?

Also, this may sound a bit more complex but have you tried using general VBScript methods like SendKeys to symulate the initial keyboard keys being entered into the field so that the list can get generated and only then perform the selection?

https://docs.microsoft.com/en-us/dotnet/framework/winforms/how-to-simulate-mouse-and-keyboard-events-in-code

I hope this can help.

If not, please get back to us again and we can look into it a bit deeper.

Thanks for sharing this item.

0 Likes
Highlighted
Contributor.
Contributor.

Re: How to open a WebList

I've tried to write some instructions such as these below:

Set objColl = getElementCollection("Browser","","title:=.*","WebEdit","html id","abcde")
objColl(0).Set "Rom"            to write into the box

Set objColl = getElementCollection("Browser","","title:=.*","WebList","html id","fghi")
objColl(0).Select "Roma (Rm)"     to select the element from the list

The problem is that they don't work.

I am sorry, but I am a beginner and I can't use UFT very well.

 

Thanks a lot,

Martina

 

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: How to open a WebList

Do you mean that the WebEdit.Set method does not invoke the suggestion list?

If so you can try below:

Browser("Google").Page("Google").WebEdit("Search").Click
set mySendKeys = CreateObject("WScript.shell")
mySendKeys.SendKeys("Chrome")

Then add the WebList.Select call.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.