Using variables in expressions for drop down menus
I am trying to make selections from a drop down menu bar.
(running against different translations so I can't use plain English text)
Instead of saying a cryptic (which works correctly)
w.MainMenu.Click('[2|4]');
I would like to say
w.MainMenu.Click('[mnuSettings|mnuConfigs]');
where mnuSettings has been defined = 2 and mnuConfigs = 4
I started with a simple version:
w.MainMenu.Click('[ProjectSuite.Variables.VariableByName(mnuSetup)]');
which gives me
"The control item '[ProjectSuite.Variables.VariableByName(mnuSetup)]' not found."
Is what I want to do possible?
Thanks
Basically, what you need to keep in mind is that the contents of your variables are the strings you are replacing. So, you need to make sure that the "Click" method, when the whole expression evaluates, looks like the string you want it to be.
In shankar_r's code, you have your first variable followed by an operator that concatenates that variable with the string '|'. That is then concatenated with your second variable.I'm not sure where the brackets are coming from that you're trying to use. Again, those are parts of the initial string. If that's the case, modify shankar_r's code like so:
w.MainMenu.Click('[' + ProjectSuite.Variables.mnuSetup + "|" + ProjectSuite.Variables.mnuConfigDisplayAndUnits + ']');