Forum Discussion

sudhir_optima's avatar
sudhir_optima
Contributor
14 years ago

How to work with WebviewWindow class object

I am working with some object which has class WebviewWindow. It has some chile objetcs. I want to work on that object.But wehn recored it records only cordinates , not directly the object ? How to handle this ?
  • Basically the object is from WebKitbrowser. Please find the attachment.



    Here i want to click on of bar > Right click > Some operation....



    It works. But with coordinates. We want to work on this by passing the Bar name. ( For example we to to right click on 'Rahul jadhav' like this.



    Can any one tell me how to find the child object for the Webkitbrowser object ? Does Testcomplete support it ?
  • Hi Smart bear team, is there any solution for this. WebviewWindowClass object display childCount property. Means it is identifyng the child object. So how to perform individual action like select,Click on those object ?
  • I have explored the MSAA mechanism and specify the Webviewwindow class. And it still recording the action as

    .............WebviewWindowClass.grouping.grouping.Click(123,455)



    Here i dont want co ordinates, rather than to click by its child object name ? Please let me know how to do this.
  • Hi Sudhir,



    TestComplete doesn't specifically support the WebKit .NET component used for displaying charts in your tested application. As you have already figured out, a possible approach to identifying elements rendered by WebKit is to use MSAA. Another option to work with the WebKit component is to use native properties and methods of the WinFormsObject("webKitBrowser1") object in your application, in particular, the Document property. This way, for example, you should be able to access the web page's DOM elements and their attributes.

    You can also vote for adding extended support for the WebKit .NET control in our survey here:

    http://support.smartbear.com/products/more-info/testcomplete-survey/



    As for the issue with the clicks recorded on the parent Grouping object instead of the child objects, I've reproduced it and forwarded it to our developers for analysis, as it might be a bug in the recorder. Thanks for drawing our attention to this, and sorry for the inconvenience.



    In the meantime, you can manually edit the recorded test and specify the needed target object for the click, e.g. grouping.grouping.Grouping(<some number>).Edit("<Label text>"). To find out the name of the Edit object corresponding to the needed chart label, please examine the chart object hierarchy in the Object Browser.
  • Thanks Helen for your reply. I have added the request and working on other workaround too. If your team has other solution , please do reply me. Thanks
  • Hi Sudhir,



    I've got results from developers regarding the clicks recorded on the parent object instead of the child objects. It's actually an issue in WebKit's MSAA implementation - the hit test for chart labels returns a parent Grouping object instead of the label objects. You can confirm this by examining the chart using the Inspect tool from Windows SDK.



    So, please use the workaround I suggested in the previous reply.
  • Hi helen,

    Your workaround works. Thanks for this. But there are few issues.

    1.Grouping No chnages when we swap the chart axis ( This is my application feature)

    2. For few chart Labels , it shows two Group item for example



    If Chart Label is 'Chezk Republic' it displayed two group item as

    ...grouping.grouping.grouping(22).Edit("Chezk")

    ...grouping.grouping.grouping(23).Edit.("Republic")



    For above tow issues I guess we can use Regular Expression but i dont know how to use it for above cases.



    Third major issue is , for large values in chart the scroll bar get activate. And above trick works only if the passing group item is visible on screen.Means the group item is there on the page, but we need to move the scroll bar. How to do this ?
  • Hi Sudhir,



    1.Grouping No chnages when we swap the chart axis ( This is my application feature)
    There're several ways to handle the dynamic hierarchy; just use the one that suits you best:



    1. Locate the target Edit objects using Name Mapping and the Extended Find setting. In this approach, you add the target object to Name Mapping, but do not add its dynamic parent objects so that they aren't used during the object identification. Here's the way to do this:

    * Open the Object Browser and locate the target Edit object.

    * From the object's context menu, select Map Object and follow the steps in the wizard.

    * In the Name Mapping editor, activate the Extended Find setting for the mapped Edit object, as explained in this article.

    * Delete the Edit object's parent Grouping objects with the dynamic index from both Mapped Objects and Aliases sections.

    Then, you can refer to the Edit object from your tests using its alias specified in Name Mapping.



    2. Locate the target Edit objects dynamically using the Find Object operation (in keyword tests) or the FindChild method (in scripts). You need to apply this operation to a constant parent object - e.g. to WebviewWindowClass.grouping.grouping, or WebviewWindowClass, or webKitBrowser1, and so on. In the search criteria, you can use the following properties and values:

    ObjectType = Edit

    Caption = <object text>





    2. For few chart Labels , it shows two Group item for example



    If Chart Label is 'Chezk Republic' it displayed two group item as

    ...grouping.grouping.grouping(22).Edit("Chezk")

    ...grouping.grouping.grouping(23).Edit.("Republic")
    This is how WebKit reports its MSAA object hierarchy. In this case, you'll need to use one of the Edit objects. I'm afraid, there's no solution other than this one.





    Third major issue is , for large values in chart the scroll bar get activate. And above trick works only if the passing group item is visible on screen.Means the group item is there on the page, but we need to move the scroll bar. How to do this ?
    You can change the chart scrollbar positions using the HScroll.Pos and VScroll.Pos properties of the WinFormsObject("panelBaseScrollable") object in your application. For example, you could increment HScroll.Pos from HScroll.Min to HScroll.Max in a loop until the VisibleOnScreen property of the target Edit object becomes True.





    I hope this helps.