Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to check if selection in menu exists..
#1
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi,
I need to check to see if an "item/selection" in the menu exists. In the application I am testing, the menu item can be called different things and could be in different position.

What I want to do is something like this:
Code:
if "Tools;Loop Options..." exists in menu select it or else check if
"Tools;XML Element Options..." exists.. etc.

Is there any way of doing this?

Thanks in advance,
Anil
Reply
#2
Solved: 11 Years, 4 Months, 3 Weeks ago
The only way I have found to do this is select the item and trap the error that is returned if it's missing. It's a little messy, but it works...hopefully. I haven't had a reason to try this in an actual script, just tried a few things after reading your post.

Code:
on error resume next 'disable error trap
VbWindow("APP").WinMenu("Menu").Select("Tools;Loop Options...")
if Err.Number <> 0 then
  VbWindow("APP").WinMenu("Menu").Select("Tools;XML Loop Options...")
end if
on error goto 0 'reset error trapping

Another option might be to see if the window exist instead of the Err.Number. if the expected window does not exist then select the other menu option. Either way you have to bypass the error handler to continue.

GL.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Windows Application Custom Combo box selection change event not firing in uft RamUFT 0 985 02-06-2020, 08:10 AM
Last Post: RamUFT
  Web List Selection mhanaan 1 7,523 11-24-2012, 03:30 AM
Last Post: imzeeshan
  SparkDropdownList value Selection Issue DivyaKurup 2 3,397 08-14-2012, 09:42 AM
Last Post: souvikghosh_diatm
  Testing field visibility based on checkbox selection anthony1carr 1 2,650 04-03-2012, 09:37 AM
Last Post: sshukla12
  text exists or not sujaravi123 3 5,301 11-09-2011, 11:57 PM
Last Post: as_srini

Forum Jump:


Users browsing this thread: 1 Guest(s)