Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Web List Selection
#1
Not Solved
Given a situation where there is more than one items in the web list i want qtp to select each item one by one and perform an action in my case to select the the item then click on a link which opens a second window at this point i want the coding to look for a value in the new screen if found then the function is to end with a message box else exit the new window and check the remaining web list item the same way until either the value is found or there are no more items on the list to select.

I am relatively new to QTP and would appreciate help on this issue
Reply
#2
Not Solved
Hi,
In such a case I would go about like this:

Code:
Dim aArray, sArrayItem, nArrayIndex, oBrowserPage, oNewWindow
Set oBrowserPage = Browser("Google").Page("Search")
'Store all items in weblist into an array separated by semi-colon (;)
aArray = oBrowserPage.WebList("lstSampleWebList").GetROProperty("all items")
'Split Weblist items and store in string variable
sArrayItem = Split(aArray,";")
'Run loop until all items have been selected in weblist or exit do statement is executed when value is found
'nArrayIndex=0
Do While nArrayIndex < UBound(aArray)
'Select item in WebList
oBrowserPage.WebList("lstSampleWebList").Select sArrayItem(nArrayIndex)
'Insert code below for the link you want to click after item selection in weblist
oBrowserPage.Link("lnkSampleLink").Click
'New Window opens, set it into an object
oNewWindow = Browser("NewWindow").Page("SearchPage")
'Search your value in the new window
oNewWindow.WebEdit("txtSearchBox").Set sArrayItem(nArrayIndex)   'Value to be searched/looked for. I'm assuming a search box is there.
'Click search button/link
oNewWindow.Link("SearchButton").Click
If oNewWindow.WebEdit("txtValueFound").GetROProperty("text") = sArrayItem(nArrayIndex) Then
'Value found. Show message box and exit Do-While block
msgbox "Value found!"
Exit Do
Else
'Value not found. Close new window and continue loop
oNewWindow.Close
End If
'Increment Array Index so that weblist can select next item.
nArrayIndex = nArrayIndex + 1
End Do

I hope it helps and is understandable.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Windows Application Custom Combo box selection change event not firing in uft RamUFT 0 951 02-06-2020, 08:10 AM
Last Post: RamUFT
  Handling Web list running Jquery Divya Srivastava 1 1,478 09-07-2018, 08:42 PM
Last Post: Ankur
  Compare second web list value according to the first web list value roselin6 1 2,812 10-07-2015, 09:14 PM
Last Post: supputuri
  SparkDropdownList value Selection Issue DivyaKurup 2 3,323 08-14-2012, 09:42 AM
Last Post: souvikghosh_diatm
  Testing field visibility based on checkbox selection anthony1carr 1 2,552 04-03-2012, 09:37 AM
Last Post: sshukla12

Forum Jump:


Users browsing this thread: 1 Guest(s)