Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
to check if an item in the list is disabled or not
#1
Not Solved
hi,
there are 4 items in my list box and 2 of them should be disabled.how can i check whether the 2 items are disbaled in the list?

pls help

Reply
#2
Not Solved
you will have to check the property called "disabled" or any other property like"readonly",etc

to do so...use the code as shown below

Code:
strDisabled=Browser().Page().webList().getRoProperty(<get the property using objectsp>)

I have noticed "disabled" holding value "true" if disabled and "false" if enabled.
If you dont see disabled property when you spy the object, you might have to look for other properties like readonly. etc.....if you didn't get this please spy the list item that you wnt to check and post the snap shot of the same.
Reply
#3
Not Solved
But using getroproperty i will get the property of list box as a whole.I need to check whether individual elements in the list box are enabled or disabled
Reply
#4
Not Solved
You may try with below code as reference.
Code:
allItems=split(Browser("title:=Find a Flight.*").Page("title:=Find a Flight.*").WebList("name:=fromPort").GetROProperty("all items"),";")

For i=0 to uBound(allItems)
  
  Browser("title:=Find a Flight.*").Page("title:=Find a Flight.*").WebList("name:=fromPort").Select  allItems(i)
     strVisible=Browser("title:=Find a Flight.*").Page("title:=Find a Flight.*").WebList("name:=fromPort").GetROProperty("visible")
If  strVisible=True Then
msgbox "Enabled" & "   " & allItems(i)
End If
Next

The above code is for the mercury tours sample web application provided by hp.Its a list box for selecting "from" during flight reservation.
Reply
#5
Not Solved
thanks Rahul for this.

But it does not solve my issue SadSad

when we specify the line " strVisible=Browser("title:=Find a Flight.*").Page("title:=Find a Flight.*").WebList("name:=fromPort").GetROProperty("visible")
", it fetches the visible property of the list box as a whole which is true always, i need to fetch the visible property of it's individual elements(whether they are visible or not)
Reply
#6
Not Solved
Code:
Browser("title:=Find a Flight.*").Page("title:=Find a Flight.*").WebList("name:=fromPort").Select  allItems(i)

This obove line will make a selection of an item.There will be few properties based on the selection.So execute the above step and get the property accordingly.If you didn't get it please post the object spy snapshot after selecting the items you want to check for.

Regards,
ravi
Reply
#7
Not Solved
Hi Sujaravi,

What happens when you try to select a disabled option? Any other enabled option gets selected? If this is the case you might try Ravi's code as below:

Code:
allItems=split(Browser("title:=Find a Flight.*").Page("title:=Find a Flight.*").WebList("name:=fromPort").GetROProperty("all items"),";")

For i=0 to uBound(allItems)
  
  Browser("title:=Find a Flight.*").Page("title:=Find a Flight.*").WebList("name:=fromPort").Select  allItems(i)
  strSelection=Browser("title:=Find a Flight.*").Page("title:=Find a Flight.*").WebList("name:=fromPort").GetROProperty("selection") //you can also use "value" instead of selection

If  StrComp(strSelection,allItems(i)) = 0 Then
Reporter.ReportEvent micDone,"Status of "&"allItems(i), "Enabled"
Else
Reporter.ReportEvent micDone,"Status of "&"allItems(i), "Disabled"
End If
Next
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is VBScripting disabled in Office 365 update? soumyarani 0 1,527 12-19-2020, 12:37 PM
Last Post: soumyarani
  How to select item within WebMenu learnasugo 4 8,101 10-11-2016, 03:35 PM
Last Post: learnasugo
  Compare second web list value according to the first web list value roselin6 1 2,838 10-07-2015, 09:14 PM
Last Post: supputuri
  Disabled Webelement is showing up as Visible =True in GUI Spy Shwethareddy 3 3,837 11-07-2012, 02:45 PM
Last Post: Ankesh
  How to select a particular check box from a list umer830 6 31,087 10-23-2012, 12:20 PM
Last Post: vjjohnson04

Forum Jump:


Users browsing this thread: 3 Guest(s)