Hi Team,
Am automating .NET Windows forms using QTP 10.0 and Test advantage 10.3.0.0.
Application uses Net advantage controls and Object identification works fine in the active window(Visible window). However am facing issues in identifying the objects where the objects are not visible in that window. I used the workaround like scroll down to make object visible .
I need to know is that the correct way or is there any settings or any othere way of identifying the object without scrolling the window.Usally its seen that QTP identifies the object in the page irrespective of scroll down.
Thanks in Advance
Hi,
Is it not identifying the object when recording them, or is it recording fine, but not identifying the objects during replay? The way you question was phrased it could lean either way, but I am guessing it is more during replay. Typically if an object not visible exception is thrown it leans towards the fact that while the object itself was found but the action requires UI interaction and the object is not on the screen. All of our actions should by the best of their ability try to scroll the control into view. So that leaves two possibilities one, the action, may for some reason be missing the scroll into view call, or something else possibly in the application is keeping it hidden.
Let's start off by testing my hypothesis about the object being found but just not visible. As of 10.3 all of our controls have at least three Get methods, GetNAProperty, GetNAProperties, GetProxySetting, these should not require the object to be visible to run. If any of these pass, then the object is found, the proxy is loaded and working correctly, it is just not visible.
Next let's assume that it maybe in the proxy, if so, what is the swftypename of the control\controls that are having the problem, and what is are the action\actions that are failing?
-Mike
Thanks Mike,
The issue of not identifying the object is during the playback. Let me drill down to the scenario so that i can give you better idea of problem am facing
I have a swfcombobox at the end of the window.To learn the object property or record, i need to scroll down the window and that works fine. During the playback am using scroll down option to make the object visible and then i will perfom the action. If i keep the action limited to just select an item from the list or get itemcount then the script works fine, however if try to validate Items count and retireve items from the comboBox then whats happening is after i read the item count the window automatically moves up making the object not visible then am using "VScroll micScrollEnd ,5scroll" to make the object visible but during retrieval(getItem) the window again moves up automatically.However if i manually scroll down the window again then it retrieves a item and immediatly window moves up again,also if i have swfbutton(submit button) to click then able to achieve using fireevent and not by regular click method.
The conclusion is that without manual intervention am not able to complete the actions for the objects needed scroll down.
swifttypename : Infragistics.Win.UltraWinEditors.UltraComboEditor
swifttypmename : Infragistics.Win.Misc.UltraButton
Hope am able give sufficient information regarding my issue.Thanks for your time and patience Mike
-Nooruddin
Hi Nooruddin,
Try adding:
SwfComboBox(...).SetFocus
before the action that interact with the combo. This action make the control the active one on the parent window and should keep it in the visible area.
Hope that works.
Ammar
Hi Ammar,
I added SwfComboBox().SetFocus and still dosent work. During the action ,QTP is looking for the object(as the Window automatically moves up).I have to scroll it down to get it setfocus.
Is there any way to stop the Window scroll move during playback?
Nooruddin
What is the swftypename for the parent container that you are calling VScroll on? Also do you have the text of the script in question? Primarily I am looking to see what are the pertinent controls, the exact actions being performed and there swftypenames to properly build a sample that reproduces the behavior. Also I am looking to see if there are any actions that may seem innocuous but may actually be causing the unexpected side effect that you are experiencing.
As a side note, along with what Ammar was saying all of our controls, by default, automatically attempt to bring themselves into view during the calling of any of our custom actions. If for some reason because of the environment or other necessity we also offer the ability to turn this off. These are via proxy settings, settable globally on our controls via swfconfig.xml or during replay-time.
There are actually two settings that may cause this effect the first, is CallPrepareForReplay, by default True, you may want to set this to false. What this setting does is turn on or of the calling of the QTP's internal PrepareForReplay method prior to completion the action. PrepareForReplay does several things, among of which are validating the existence of the object, and making it visible.
The second is AutoScrollIntoView, by default True, you may want to set this to false. What this does is go up the parent tree of container controls that are scrollable, and in turn scroll each control in the link between the parent form and SourceControl into view.
Neither of which should cause issues but as Scrolling seems to be the root of your problem, it may be worth testing the settings of each. You can view the current setting via :SwfObject("SomeNAControl").GetProxySetting(sSettingName)
or set them via :
SwfObject("SomeNAControl").SetProxySetting sSettingName, oNewValue
eg. SwfObject("comboEditor1").SetProxySetting "CallPrepareForReplay", True
Again I don't think either of these settings are the cause, but it may be something to try in addition to supplying the information I requested earlier in this message.
Thanks a lot Mike,
From the Solutions you provided i tried the below code and it worked fine.
SwfWindow("--").ActivateSwfWindow("--").SwfObject("--").VScroll micScrollEnd ,5SwfWindow("--").SwfComboBox("--").SetProxySetting AutoScrollIntoView , False
Below is the sample code which i was trying earlier
''&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&SwfWindow("--").SwfObject("--").VScroll micScrollEnd ,5Counter = 0objlistcount = SwfWindow("--").SwfComboBox("--").GetItemsCount For i = 0 to objlistcount-1 objitemval = SwfWindow("--").SwfComboBox("--").GetItem(i) IF objitemval = Trim(sData1)Then SwfWindow("--").SwfComboBox("--").Select sData1 Reporter.ReportEvent micPass, "Data : " & sData1 & "successfully selected" , "Pass" Counter = 1 Exit For End If Next IF Counter <>1 Then Reporter.ReportEvent micPass,"Data :"& sData1 & "Not Present in the List","Step Failed" End If''&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Well Mike, as the issue of autoscrolling seems to be resolved, i would like to know is this the only way or there is better way of identifying the object without using vScroll.
Swftypename for SwfObject = SRDashSolution.PhoneManagmentModule.OnePageView
-NooruddinAutomation, HP-IT
To be honest I am at a loss for why this issue is happening. My first thought is that there is something about the container control (SRDashSolution.PhoneManagementModule.OnePageView) or maybe your environment that may be causing this behavior. The container does appear to be a custom container in some manner. As to the environment I have seen other similar odd behaviors when our NetAdvantage WinForm controls are added to an ASP.NET page, I imagine same difference if it was added to a WPF or Silverlight environment. Not sure that is the case, but I would be curious if that is the scenario.
I am curious, did you add the VScroll to the script because it wouldn't scroll into view on it's own? If not have you tried without the VScroll and without turning off the AutoScrollIntoView?
A developer support case has been opened on this matter on your behalf. I would recommend them reviewing this in more detail with you, and if possible if you could provide them a sample of this behavior it would greatly help us in determining the cause of the behavior.
Noruddin,
Case CAS-63752-GVG0LN was created for this and I reached out to you to get the information that Mike has requested through the case. You can see this case from the My Support Activity page.
Let me know if you have any questions with this matter.
Well even i was surprised when i noticed that objects are not auto scrolling into view and i was forced to use VScroll and then noticed that after every action on the object ,the Window was automatically auto scrolling and then you provided me with the solution of setting AutoScrollIntoView as false which worked.
To be informed, i did try without using vScroll and also without turning off AutoScrollIntoView,but not dint work.
To bring to your notice, am actually thinking that there may be slight issue with coding over identification of .Net advantage control. This is just my observation and only developers can drill down more on this. The observation is that after every action on the object, the system seems AutoScrollIntoView method to be actually scrolling UP rather the doing only when required. Say if you are working with single window application then you may not notice any difference in behaviour afrer the action, However if you got the applications which has multiple Window(pages) where you need to scroll down to get it visible, the problem of AutoScrollIntoView seems to be causing to move the window UP after a action is performed. I may be wrong but this is what i can say from my experience on working with Test advantage Add-in with my application. Also to be informed that if i execute cases in application manually the system doesnt scroll up
I hope the information provided helps and mail me across if any other information is required.
Regards
HP-IT