Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Selecting a WebElement from a List of Web Elements
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi All,
I am working on a scenario, where I need to select a particular item from a list of items in a Window. The I have written is below:

Code:
'Initializing a Flag
Valid=False
Set objShell=CreateObject("WScript.Shell")
'Looping the statement
Do Until Valid=True
'Itemname is the name of the WebElement I need to select
If(Brw(X).Pg(X).WebElement("html tag:=TD","innertext:="itemname,"outertext:="itemname,"index:=1").Exist (2))Then
Brw(X).Pg(X).WebElement("html tag:=TD","innertext:="itemname,"outertext:="itemname,"index:=1").Click
'The below statement will add the selected Item to the "Selected Items panel"
Brw(X).Pg(X).WebElement("class:=bi-button button.*","innertext:=>>","index:=1").Click
Valid=True
Else
'Here the Page down button will be pressed if the WebElement is not found in the visible.Just like a Scroll Down
objShell.SendKeys "{PGDN}"
Valid=False
Loop

The problem I face with the above code is that some times the incorrect item gets selected to the "Selected items window". If I dont use index I get "Object description matches more than one WebElement" error.

The incorrect item that gets selected is always just above or below the correct one. Most of the times code works properly, sometimes I got wrong things selected. eg: I need to select 'Delete' item whose innertext value is 'Delete'.

Delete a value
Delete
Delte by name

The aboce code selects, "Delete a value" or "Delete by name" instead of 'Delete' from the list.

Note: No html id available. Im working on a Web application that runs in IE8.

I hope someone could help me in fixing the codes
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
Just changed the order for selecing the items... It works fine..Very Wiered...
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Handling Web list running Jquery Divya Srivastava 1 1,509 09-07-2018, 08:42 PM
Last Post: Ankur
  Compare second web list value according to the first web list value roselin6 1 2,848 10-07-2015, 09:14 PM
Last Post: supputuri
  Searching for and selecting row in Datawindow zsl0009 0 2,810 08-04-2015, 01:02 AM
Last Post: zsl0009
  Problem selecting in a dropdown menu during playback. qemls29 9 13,043 07-28-2015, 05:44 PM
Last Post: Sharan
  Selecting Link Magad 1 2,824 11-07-2014, 03:56 AM
Last Post: PrateepKaraval

Forum Jump:


Users browsing this thread: 1 Guest(s)