I am using various Attach statements in my scripts and am having trouble with the naming of said scripts.
As an example, I have a ListBox within a pop-up window "Data". So I identify the box with QARun's Identify feature and get a result - "Item ListBox", however, when i run a script that tells me it cannot attach to the window I have just identified, I re-identify the control and it gives me "Data ChildWindow".
Is there something that causes this that I can stop?
Neither of the names work all of the time and I don't have the time to have to identify the window every time I run the script.
I tried using:
Attach "Item ListBox" OR "Data ChildWindow"
which makes it through compilation, but does not work at run-time.
I've tried both. I can't see what is changing the name of the pop-up as I have it open while I'm testing it, and it usually starts off as "Item ListBox", then after running the tests a couple of times, it will change to "Data ChildWindow". If I continue, it changes back again after running the tests a few more times!
My strong feeling is that there is something happening with you learn settings.
there is option to set the attach each and every component that is it will attach each component it come across and then perform the action on that component.I dont remember the actual learn setting name as i am currently working in QTP.
I think this setting should consistency recognize ur listbox as
Attach "Item Listbox"
--action on listbox
It may very well be that you are really dealing with two distinct windows in part of your application. They just happen to have very similar sounding names. I see this all the time.
I have had people try to "pre-identify" all the controls/windows in an application and then try to record. That approach is problematical. There is a lot of smarts built into QARun for object recognition, and you can't hope to know all the criteria it uses. If you pre-identify, you are basically presupposing that you are smarter about windows object mapping than QARun is. My advice has always been to allow QARun to identify controls on the fly when you are recording a script. That way, you don't confuse QARun by telling it to look for the wrong control/window. It does an admirable job of figuring that out all by itself, if you let it.
I think Rajesh may be onto something too. The learn settings will have an effect on how items in the object map are identified. Take a look at them and make sure you have it the way you want it.
I'd start a new database in QARun and then record a script to do what you want to do, letting QARun do all the object identification on the fly. I suggest that because your present object map may have so many corrupted entries in it that you will never be able to recover in the present database. QARun always wants to look in the object map first to see if it has already mapped the object, based on characteristics of the object. If it finds one that meets the criteria, but one of the criteria it didn't use for selection is different (between your actual object and the one in the object map), it will hook up to the wrong object and give you the results you are seeing.