how to retrive the value of combobox, texbox that are part of the swftoolbar
for e.g. if my toolbar cotains one combobox
1. i select particular value in the combo box
2. then i click the apply button
now wht i want, i want to retrive the selected value. as my qtp recognises only swftoolbar and not the individual controls in it.
i tried to check the function getItemProperty i am getting error:
parameter key not found.
SwfWindow("").SwfToolbar("").GetItemProperty(toolbarname,strtool,"Enabled")
Correct QuickTest Professional(QTP) only really interacts with objects that derive from System.Windows.Forms.Control. The tools internal to the Infragistics UltraToolbarsManager are not controls, they are just abstract objects that may resemble controls. The UltraToolbarsManager itself is not a tool either, but a component, but is typically housed on a custom dockarea or a custom popup window, and that is the control we generally interact with as far as QTP is concerned.
That being said, you should be able to generally still get the current property values via the base Tools collection. Such as :
msgbox SwfWindow("").SwfToolbar("").GetNAProperty("Tools["+strToolKey+"].Value")
This should work primarily because all tools regardless of where they are located are just instances of the root tool in the Tools collection. All values, if there the tool has a value, are thereby shared with all instances of the root tool.
If it cannot find it there, it could possibly be an MDIMerged tool, ie a tool that existed on a parent window, that was merged down the the ToolbarsManager on a child window, and you are trying to interact with it on the Child window. In that case you would need to access it slightly differently:
msgbox SwfWindow("").SwfToolbar("").GetNAProperty("MergedTools["+strToolKey+"].UnderlyingTool.Value")
I hope this offers you a valid solution,
for the first solution its giving error as:
IG : Member [Value] not valid.
Hi,
Key not found in the MergedTools collection means that it is not a merged tool, so that rules that logic out. As to the Tools[strToolKey].Value not working. Since it didn't give you a Key not found exception, means it did find the tool. Just that the tool in question doesn't have a value property. The question is why? Are you looping through all of the tools, and since some Tools don't inherently have a Value property the error is thrown? If you are only interacting with only one Tool, that tool then isn't one of the following: ComboBoxTool FontListTool MaskedEditTool
So the question is what is the tool type, and from that we can determine what properties are appropriate. If your are working with TestAdvantage 10.3 or later, you should also have access to GetNAProperties, which will give you a list of all available properties during runtime on the instance of the object that you are looking at. So you can do something like the statement below and it will list all the available properties and their return types.
msgbox SwfWindow("").SwfToolbar("").GetNAProperties("Tools["+strToolName+]")
I hope this helps,
IG : Member [Tools] not valid.
still the same issue i m getting
the controls hierarchy is something like this
window -> toolbar -> ribbon -> tabs -> groups -> tools
hope it could help you in giving solution
Can you paste the exact line of code that is giving you the error message "IG : Member [Tools] not valid."? The reason I ask is "Tools" is definitely a valid property on the ToolbarsManager, so I believe something else is going on here.
Hello Shirkaan,
I created CAS-86241-K7XT7G to assist you with this.
I want to check that one of the tool is enabled or not.
I am using following code:
SwfWindow("AVEV Instrumentation").SwfWindow("SwfWindow").SwfToolbar("SwfToolbar").GetNAProperty("Tools[Issue].Value")
It is throwing exception that Tool[Issue] not valid.
I want to check that 'Issue' tool is enabled.
How to use 'EnabledResolved' property in above code?
Please help me out.
Now what i want to retrieve the all items in that particular combo box. can u help me in this regard?
hi, i was able to find the value of that particular combo box using the following lines of code.
here KeyStringCal is my own array with the keys of the combo boxes i want to take.
because "Value" property is valid for combo box, text box whether "text" property is valid for calender or dateselector i suppose.
set Toolbars = SwfWindow("").SwfToolbar("").Object.ToolbarsManager.Tools
For x = 0 to (Toolbars.count) -1 For y = 0 to arraycount If Toolbars.GetItem(x).Key = KeyStringCal(y) Then PutValues(y) = Toolbars.GetItem(x).value End if Next Next