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
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
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
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.
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?
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
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.
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.
Alan HalamaSupport ArchitectInfragistics
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.
At this point I can poke blindly at a few hypothetical solutions, but as mentioned before I believe we will need a sample that reproduces this behavior, to truly understand what's going on and how to resolve it. The only other scenario I can see that would do as you describe is a little far fetched, being that the control's upper left hand corner is being recognized as the point it is scrolling up to, which in that case, there would be no "permanent fix" for that scenario. Turning off the AutoScrollIntoView, and manually scrolling the portion of the control that you need to interact with would be the resolution. Does this happen with every control that needs to be scrolled into view or just this solitary UltraComboEditor?
firstly am not able to add any notes/Comment at the location
coming back to the issue, we are facing this issue with all controls which needs to be scrolled into view. Manually scrolling the objects into view is bit tedious and sometime may turn up to be unreliable and thats were we thought of having permanent fix.
In my previous notes/blog i have provided with the sample script to reproduce, however i shall provide you once again the script, but i would like to know what excatly you are looking in the script which will help you reproduce the scenario
SwfWindow("SR-Dash").SwfObject("OnePageView").VScroll micScrollEnd ,5
SwfWindow("SR-Dash").SwfComboBox("List_Severity").SetProxySetting AutoScrollIntoView , FalseSwfWindow("SR-Dash").SwfComboBox("List_Severity").Select "Medium"
SwfWindow("SR-Dash").SwfComboBox("List_Priority").SetProxySetting AutoScrollIntoView , FalseSwfWindow("SR-Dash").SwfComboBox("List_Priority").Select "High"
SwfWindow("SR-Dash").SwfButton("Button_CreateCase").SetProxySetting AutoScrollIntoView , False SwfWindow("SR-Dash").SwfButton("Button_CreateCase").Click
I have reached out to you through email to look into the issue with updating case CAS-63752-GVG0LN and will work with you on that through email.
For looking into the issue with scrolling the controls into view, we need a sample application that has the same issue that we can use for debugging. Only having the script isn't enough for us to look into this issue. As such if you are able to, please provide us with a sample application that demonstrates the same issue.
I face a similar issue with WpfObject inside a WpfWindow. Please help.
WpfWindow("Window Name").WpfObject("ObjectName").GetCellData(RowNum, "columnName") provides the cell value as long as the cell is in the visible screen. I have 300 to 1000 items to be displayed in the cell. There is no item name to provide in the ScrollIntoView method. The object spy shows the cell as WpfObject inside WpfWindow("Window Name").WpfObject("ObjectName").
Thanks in adavance for your help!
I think ScrollIntoView is the method to work with Net advantage controls for .NET windows forms application.
Am not clear with the problem you are facing, however let me guess and provide you the solution that might help.
I would like to know that after each action/operation is that the application window is auto scrolling back to top of the window?
>>> Try using the method VScroll to scroll it down and perform the operation
>>> You can also try the method object.MakeVisible
>>> Trying using the object model to access native methods (WpfWindow("ObjectName").Object.)
Actually i noticed that most of the window's based objects needs to be visible to automate and you can always drill it down and try all the options either to make it visible, not allow to scroll it up or autoscroll and if it is third party controls then you need to check whether you can get add-in or support to automate those controls. Please let me know if it works and alos correct me if my understanding are incorrect
Automation - HPIT