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,
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
http://www.infragistics.com/membership/mysupport.aspx?CaseNumber=CAS-63752-GVG0LN
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
Regards
Nooruddin
Nooruddin,
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.
Let me know if you have any questions with this matter.
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!
Hi Sasha,
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
Thanks
Automation - HPIT
There is currently only extremely limited support for our WPF controls at the moment via QTP alone. We are in the process of developing TestAdvantage for WPF to support our NetAdvantage WPF controls version 10.3 and higher, due out by the end of the year, with a by request CTP available via sales@infragistics.com.
Thanks, Nooruddin!
I have a long list of values which is seen only partially on the screen. I need to retrieve the max value of a specific column for which I had to scroll to end since the column was displayed in ascending order. Now that I have got a solution of sorting the column, I can double click on the column header and have the maximum value on top. However, I dont know a method to access the column header of the wpfobject for sorting.
WpfWindow("Window1").WpfObject("Object1").GetCellData(rowNum ,columnNum) gets me the celldata. But I have no means to click or double click on the columnheader. This being the 13th column, I can go uptil WpfWindow("Window1").WpfObject("Object1").GetCellData(0,columnNum) which gives me the first row 13th grid value. ("M" in the following sample)
C1
C2
C3
C4
C5
C6
C7
C8
C9
C10
C11
C12
C13
C14
C15
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
I hope the problem is clear now. Thanks much for your help!
btw, when I was researching on the scroll issue, I found this useful post by Yaara Tobaly http://www.advancedqtp.com/forums/index.php?action=printpage;topic=5151.0
-Sasha
I have gone through the post by Yaara Tobaly and it is very useful one as it deals with the mouse event actions through declaring and using the procedures of external dll's. In most of the cases this would work and in some cases where change in system or resolution may fail or not reliable because it may trigger the mouse scroll and would not notice any change in the application behaviour and script will fail.
Well are you able to resolve the issue using that function?
I would advice you to go ahead and check for the native methods to scroll (Hscroll or Vscroll) to view the objects into view.
Sasha ,If am not wrong then you are working with WpfTable object right? When you try to add the object see the hierarchy and add it as table object and try WpfTable(Object).Makevisible. Also, you can try all other methods available.Please let me know if it works.
Nooruddin -
Mouseevent helped to scroll down. However, I have tables of different length at each time. I am failing to arrive at a good number of scrolls (to pass into Mouse scroll event).
I do not see the table as a WpfTable. Object spy only shows and QTP only recognizes the control as WpfObject !
As I was trying to explain in the previous post, I am now given a feature to sort the column by double clicking on the column header. so then I dont need to scroll down but sort in descending order and get the first row's interested column value (using getcelldata).
So I have a different issue now..Not the scrolling but to sort by double click on the column header (of the WpfObject). I cant access the columnheader by any means. When I try to record sorting step, it gets recorded as WpfWindow("Window1").WpfObject("Object1").Click 611, 15. This doesnt help since the columns are so adjacent to each other, replay ends up cliking on the wrong column always..and I need to double click.. not just Click.
:-( thats where am stuck now! Thanks again!
If my understanding is correct.. you are actually facing issue with double click on the column header so that you can sort and retreive the max value. Also you said that the click action is not reliable and clicking the wrong column..
Please try the below code and check.. If required slightly modify(I mean you can add or subtract for x and y axis).Below code has worked for me with winobject methods where normal recording and click was not reliable to get the edit box activated.
You need to pass the object which you need to click..You can also use descriptive way to identify the object you need to click.
If possible can you attach the screen shot of your table under test so that i can visually understand the problem you are facing and probably i can tell my logic or way of approaching to the issue.. It shall help a lot it debugging...
Public Function funcDeviceClick(ByRef obj) Dim x1, y1, dr x1 = -1 y1 = -1 If (Not isNull( obj)) And obj.Exist(5) Then x1= obj.GetROProperty("abs_x") + obj.GetROProperty("width")/2 y1= obj.GetROProperty("abs_y") + obj.GetROProperty("height")/2 If x1 > 0 and y1 > 0 Then Set dr = CreateObject("Mercury.DeviceReplay") dr.MouseClick x1, y1,micLeftBtn 'dr.MouseClick x1, y1,micLeftBtn '' Uncomment this if you want double click 'Reporter.ReportEvent micDone, "check x y", " x = " & x1 & ", y = "& y1 Wait 1 Set dr = Nothing End If Else Reporter.ReportEvent micFail, "Device Click Failed", "Not able to find the object" End IfEnd Function