com.rational.test.ft.domain.html

Class HtmlGuiProxy

  • All Implemented Interfaces:
    com.rational.test.ft.domain.IChannelObject, com.rational.test.ft.domain.IDataDriven, com.rational.test.ft.domain.IGetInterestingRecogProsForDynFind, com.rational.test.ft.domain.IHtmlCustomDomainEnablement, com.rational.test.ft.domain.IInternalObjectStatus, com.rational.test.ft.domain.IProxyBase, com.rational.test.ft.domain.IQuickFind, com.rational.test.ft.domain.IXPathFind, com.rational.test.ft.object.interfaces.IGraphical
    Direct Known Subclasses:
    ElementProxy, EmbeddedBrowserProxy, GenericHtmlGuiProxy, HtmlDocumentProxy, MapProxy, SubobjectProxy, TableDataCellProxy, TableRowProxy, TextNodeProxy, TopLevelWindowProxy


    public class HtmlGuiProxy
    extends HtmlProxy
    implements com.rational.test.ft.object.interfaces.IGraphical
    This is the HTML GUI object proxies base class, all HTML GUI proxies must extend this class. The abstract ProxyTestObject base class defines the non-GUI object properties required to implement a proxy object. This abstract class extends that definition with the additional properties needed for a GUI object.

    This class further contains the default implementation of various base class methods that proxy implementations may need to extend or override.

    • TestObject Interface: GuiTestObject

    • Supported Test Data Types:
      TypeDesciption
      text Visible Text ITestDataText

    • Default Recognition Properties:
      • .class
      • .classIndex
      • .id
      • .title

    • Supported Canonical Properties:
      PropertyUsage
      .bounds A rectangle representing the bounding rectangle of the object in screen coordinates.
      .class This is the  test object class name, for example "HtmlTable" for a <Table> element.
      .id This is the value of the id attribute of an element.
      .name This is the value of the name attribute (Form elements and Frames only)
      .offsetHeight The height of the element.
      .offsetLeft The offset of the element from its offset parent in the DOM.
      .offsetTop The offset of the element from its offset parent in the DOM.
      .offsetWidth The width  of the element.
      .tag This is the Html tag for the element
      .text This is the text inside of the HTML tags for bounding the element.  For example, <A>This is an Anchor<IMG src=map.gif></a>   the text property will return "This is an Anchor.   All white space are combined and reduced to a single a blank character if consecutive white space characters are found.
      .title This is the value of the title attribute of an element.  This is frequently the text displayed when hovering over the element with the mouse.

    Since:
    1.0
    • Constructor Detail

      • HtmlGuiProxy

        public HtmlGuiProxy(HtmlTestDomainImplementation domain,
                            com.rational.test.ft.domain.IChannel channel,
                            long handle,
                            com.rational.test.ft.domain.html.chrome.IBrowserCommunicator jswrap)
    • Method Detail

      • getTestObjectClassName

        public java.lang.String getTestObjectClassName()
        Description copied from class: HtmlProxy
        The default GUI marshaller is returned. More specific marshallers are returned by more constrained proxy classes. This level of support is always required.
        Specified by:
        getTestObjectClassName in interface com.rational.test.ft.domain.IProxyBase
        Overrides:
        getTestObjectClassName in class HtmlProxy
        Returns:
        The default mashaller class full name.
      • click

        public void click()
        Specified by:
        click in interface com.rational.test.ft.object.interfaces.IGraphical
      • click

        public void click(com.rational.test.ft.script.MouseModifiers modifiers)
        Specified by:
        click in interface com.rational.test.ft.object.interfaces.IGraphical
      • clickWithMouse

        public void clickWithMouse(com.rational.test.ft.script.MouseModifiers modifiers)
      • click

        public void click(com.rational.test.ft.script.MouseModifiers modifiers,
                          java.awt.Point pt)
        Specified by:
        click in interface com.rational.test.ft.object.interfaces.IGraphical
      • clickAtScreenPoint

        protected void clickAtScreenPoint(com.rational.test.ft.script.MouseModifiers modifiers,
                                          java.awt.Point screenPoint)
        Generate a click at the screen point.
        Parameters:
        modifiers - -
        screenPoint - - point in screen coordinates
      • restoreTopLevelWindow

        protected void restoreTopLevelWindow()
      • activateTopWindow

        protected void activateTopWindow()
      • click

        public void click(java.awt.Point pt)
        Specified by:
        click in interface com.rational.test.ft.object.interfaces.IGraphical
      • doubleClickAtScreenPoint

        protected void doubleClickAtScreenPoint(com.rational.test.ft.script.MouseModifiers modifiers,
                                                java.awt.Point screenPoint)
      • doubleClick

        public void doubleClick()
        Specified by:
        doubleClick in interface com.rational.test.ft.object.interfaces.IGraphical
      • doubleClick

        public void doubleClick(com.rational.test.ft.script.MouseModifiers modifiers)
        Specified by:
        doubleClick in interface com.rational.test.ft.object.interfaces.IGraphical
      • doubleClick

        public void doubleClick(com.rational.test.ft.script.MouseModifiers modifiers,
                                java.awt.Point pt)
        Specified by:
        doubleClick in interface com.rational.test.ft.object.interfaces.IGraphical
      • doubleClick

        public void doubleClick(java.awt.Point pt)
        Specified by:
        doubleClick in interface com.rational.test.ft.object.interfaces.IGraphical
      • drag

        public void drag()
        Specified by:
        drag in interface com.rational.test.ft.object.interfaces.IGraphical
      • drag

        public void drag(com.rational.test.ft.script.MouseModifiers modifiers)
        Specified by:
        drag in interface com.rational.test.ft.object.interfaces.IGraphical
      • drag

        public void drag(com.rational.test.ft.script.MouseModifiers modifiers,
                         java.awt.Point pt1,
                         java.awt.Point pt2)
        Specified by:
        drag in interface com.rational.test.ft.object.interfaces.IGraphical
      • snapToRectangle

        public static java.awt.Point snapToRectangle(java.awt.Rectangle rect,
                                                     java.awt.Point originalPoint)
      • drag

        public void drag(java.awt.Point pt1,
                         java.awt.Point pt2)
        Specified by:
        drag in interface com.rational.test.ft.object.interfaces.IGraphical
      • dragToScreenPoint

        public void dragToScreenPoint(com.rational.test.ft.script.MouseModifiers modifiers,
                                      java.awt.Point objectPoint,
                                      java.awt.Point screenPoint)
        Specified by:
        dragToScreenPoint in interface com.rational.test.ft.object.interfaces.IGraphical
      • dragToScreenPoint

        public void dragToScreenPoint(java.awt.Point screenPt)
        Specified by:
        dragToScreenPoint in interface com.rational.test.ft.object.interfaces.IGraphical
      • dragToScreenPoint

        public void dragToScreenPoint(java.awt.Point objectPoint,
                                      java.awt.Point screenPoint)
        Specified by:
        dragToScreenPoint in interface com.rational.test.ft.object.interfaces.IGraphical
      • dragAtScreenPoint

        protected void dragAtScreenPoint(com.rational.test.ft.script.MouseModifiers modifiers,
                                         java.awt.Point screenPoint1,
                                         java.awt.Point screenPoint2)
        Generate a drag using the screen points.
        Parameters:
        modifiers - -
        screenPoint1 - - point in screen coordinates
        screenPoint1 - - point in screen coordinates
      • getScreenPoint

        public java.awt.Point getScreenPoint()
        Specified by:
        getScreenPoint in interface com.rational.test.ft.object.interfaces.IGraphical
      • getScreenPoint

        public java.awt.Point getScreenPoint(java.awt.Point objectPoint)
        Specified by:
        getScreenPoint in interface com.rational.test.ft.object.interfaces.IGraphical
      • getScreenRectangle

        public java.awt.Rectangle getScreenRectangle()
        Specified by:
        getScreenRectangle in interface com.rational.test.ft.object.interfaces.IGraphical
      • getClippedScreenRectangle

        public java.awt.Rectangle getClippedScreenRectangle()
        Specified by:
        getClippedScreenRectangle in interface com.rational.test.ft.object.interfaces.IGraphical
      • hasFocus

        public boolean hasFocus()
        Specified by:
        hasFocus in interface com.rational.test.ft.object.interfaces.IGraphical
      • hover

        public void hover(double delay)
        Specified by:
        hover in interface com.rational.test.ft.object.interfaces.IGraphical
      • hover

        public void hover(double delay,
                          java.awt.Point pt)
        Specified by:
        hover in interface com.rational.test.ft.object.interfaces.IGraphical
      • hover

        public void hover()
        Specified by:
        hover in interface com.rational.test.ft.object.interfaces.IGraphical
      • hover

        public void hover(java.awt.Point pt)
        Specified by:
        hover in interface com.rational.test.ft.object.interfaces.IGraphical
      • hoverAtScreenPoint

        protected void hoverAtScreenPoint(double delay,
                                          java.awt.Point screenPoint)
      • getScreenCenter

        protected java.awt.Point getScreenCenter()
        Get screen rectangle for object and caluclate the center point of the rectangle.
        Returns:
        center point of object in screen coordinates.
      • isEnabled

        public boolean isEnabled()
        Specified by:
        isEnabled in interface com.rational.test.ft.object.interfaces.IGraphical
      • isOpaque

        public boolean isOpaque()
        Specified by:
        isOpaque in interface com.rational.test.ft.object.interfaces.IGraphical
      • getClippingParent

        public com.rational.test.ft.object.interfaces.IGraphical getClippingParent()
        Get the clipping parent for this object. The clipping parent is the object whose rectangle will clip all of its children, usually the browser or a frame. Unfortunately, it can also be a div tag in the object hierarchy, so going directly to the document does not worl
      • getClippingParentRectangle

        public java.awt.Rectangle getClippingParentRectangle()
        Return the screen rectangle of this objects clipping parent.
      • isPointInObject

        public boolean isPointInObject(java.awt.Point point)
        Specified by:
        isPointInObject in interface com.rational.test.ft.object.interfaces.IGraphical
      • isPointInObject

        public boolean isPointInObject(long handle,
                                       int x,
                                       int y)
      • ensureObjectIsVisible

        public boolean ensureObjectIsVisible()
      • scrollIntoView

        public boolean scrollIntoView()
      • scrollIntoView

        public boolean scrollIntoView(boolean scrollDirection)
      • scrollIntoView

        protected boolean scrollIntoView(long nativeHandle)
      • scrollIntoViewN

        protected boolean scrollIntoViewN(long handle)
      • scrollIntoViewWithDirection

        protected boolean scrollIntoViewWithDirection(long nativeHandle,
                                                      boolean scrollDirection)
      • scrollIntoViewWithDirectionN

        protected boolean scrollIntoViewWithDirectionN(long handle,
                                                       boolean scrollDirection)
      • getChildAtPoint

        public java.lang.Object getChildAtPoint(java.awt.Point pt)
        Finds the most interesting child object at the specified point. Note that the point is relative to the top left corner of the screen, and not the component itself or its parent.

        If this object has no children, it should return null.

        Specified by:
        getChildAtPoint in interface com.rational.test.ft.object.interfaces.IGraphical
        Parameters:
        pt - Screen relative point to check.
        Returns:
        The object at the point or null if no child object is found.
        See Also:
        getScreenRectangle()
      • proxyGetChildAtPoint

        public java.lang.Object proxyGetChildAtPoint(java.awt.Point pt)
      • convertFromScreenToOffset

        public java.awt.Point convertFromScreenToOffset(java.awt.Point pt)
      • getChildAtPoint

        public long getChildAtPoint(long handle,
                                    int x,
                                    int y)
      • getChildAtPointN

        public long getChildAtPointN(long handle,
                                     int x,
                                     int y)
      • isShowing

        public boolean isShowing()
        Specified by:
        isShowing in interface com.rational.test.ft.object.interfaces.IGraphical
      • isInView

        public boolean isInView()
        Is the object in view (not clipped)?
      • isInView

        public boolean isInView(java.awt.Point pt)
      • mouseMove

        public void mouseMove(com.rational.test.ft.script.MouseModifiers modifiers,
                              java.awt.Point pt)
        Specified by:
        mouseMove in interface com.rational.test.ft.object.interfaces.IGraphical
      • mouseMove

        public void mouseMove(java.awt.Point pt)
        Specified by:
        mouseMove in interface com.rational.test.ft.object.interfaces.IGraphical
      • nClick

        public void nClick(int clickCount,
                           com.rational.test.ft.script.MouseModifiers modifiers)
      • nClick

        public void nClick(int clickCount,
                           com.rational.test.ft.script.MouseModifiers modifiers,
                           java.awt.Point pt)
        Specified by:
        nClick in interface com.rational.test.ft.object.interfaces.IGraphical
      • nClickAtScreenPoint

        protected void nClickAtScreenPoint(int clickCount,
                                           com.rational.test.ft.script.MouseModifiers modifiers,
                                           java.awt.Point screenPoint)
        Generate a nClick at the screen point.
        Parameters:
        modifiers - -
        screenPoint - - point in screen coordinates
      • nClickDrag

        public void nClickDrag(int clickCount,
                               com.rational.test.ft.script.MouseModifiers modifiers,
                               java.awt.Point pt1,
                               java.awt.Point pt2)
        Specified by:
        nClickDrag in interface com.rational.test.ft.object.interfaces.IGraphical
      • nClickDragToScreenPoint

        public void nClickDragToScreenPoint(int clickCount,
                                            com.rational.test.ft.script.MouseModifiers modifiers,
                                            java.awt.Point objectPt,
                                            java.awt.Point screenPt)
        Specified by:
        nClickDragToScreenPoint in interface com.rational.test.ft.object.interfaces.IGraphical
      • nClickDragAtScreenPoint

        protected void nClickDragAtScreenPoint(int clickCount,
                                               com.rational.test.ft.script.MouseModifiers modifiers,
                                               java.awt.Point screenPoint1,
                                               java.awt.Point screenPoint2)
      • processMouseEvent

        public void processMouseEvent(com.rational.test.ft.domain.IMouseActionInfo action)
        Return a MethodSpecification for the specified mouse event. This is the primary record interface for mouse events against a particular control. This implementation calls getActionArgs to generate the appropriate subitem specification. Subclasses which generate subitem specifications should override getActionArgs.
        Overrides:
        processMouseEvent in class HtmlProxy
        Parameters:
        action - The event cache and other mouse state information for this mouse action.
        See Also:
        MethodSpecification, getActionArgs(java.awt.Point)
      • processHoverMouseEvent

        protected void processHoverMouseEvent(com.rational.test.ft.domain.IMouseActionInfo action)
      • processPreDownMouseEvent

        protected void processPreDownMouseEvent(com.rational.test.ft.domain.IMouseActionInfo action)
      • getMethodName

        protected java.lang.String getMethodName(com.rational.test.ft.domain.IMouseActionInfo action)
      • getPointFromAction

        public java.awt.Point getPointFromAction(com.rational.test.ft.domain.IMouseActionInfo action,
                                                 int index)
      • processPreUpMouseEvent

        protected void processPreUpMouseEvent(com.rational.test.ft.domain.IMouseActionInfo action,
                                              int clicks,
                                              boolean isDrag)
        This method is called to process a mouse event, IMouseActionInfo.PRE_UP event state On PRE_UP build a new method specification will override the one recorded on the PRE_DOWN. Note: For efficiency, the Subitems may have already been constructed while handling previous PRE_DOWN or PRE_UP event states.
      • getCurrentMethod

        public java.lang.String getCurrentMethod()
      • setCurrentMethod

        public void setCurrentMethod(java.lang.String currentMethod)
      • setMethodSpecification

        protected void setMethodSpecification(com.rational.test.ft.domain.IMouseActionInfo action,
                                              java.lang.String method,
                                              java.util.Vector args)
      • setMethodSpecification

        protected void setMethodSpecification(com.rational.test.ft.domain.IMouseActionInfo action,
                                              java.lang.String method,
                                              java.util.Vector args,
                                              com.rational.test.ft.script.ScriptCommandFlags flags)
      • setClickArgs

        protected java.util.Vector setClickArgs(int modifiers)
        Set args for click (depends on clickArgs member variable set by getActionArgs in PRE_DOWN)
      • setDownPointArgs

        protected java.util.Vector setDownPointArgs(int modifiers)
        Set args for down point (depends on clickArgs member variable set by getActionArgs in PRE_DOWN)
      • setDrag

        protected java.util.Vector setDrag(com.rational.test.ft.domain.IMouseActionInfo action,
                                           int modifiers,
                                           java.awt.Point firstPoint,
                                           java.awt.Point nthPoint)
        Set args and method for single click drag member variable screenRect must be set before calling this method.
      • setMultiClickAction

        protected java.util.Vector setMultiClickAction(int clicks,
                                                       int modifiers,
                                                       boolean isDrag,
                                                       java.awt.Point firstPoint,
                                                       java.awt.Point nthPoint)
        Set args for multi-click action (more than two clicks in one place, or more than one click drag) member variable screenRect must be set before calling this method.
      • getDefaultPointToClick

        protected java.awt.Point getDefaultPointToClick()
        Determines the default click point by performing hit tests on candidates. This is required since a the point to click should always click on the object 1) Try the center. 2) try points along a diagonal from top left to bottom right.
      • getDefaultPointToClick

        protected java.awt.Point getDefaultPointToClick(java.awt.Rectangle screenRect)
        Determines the default click point by performing hit tests on candidates. This is required since a the point to click should always click on the object 1) Try the center. 2) try points along a diagonal from top left to bottom right.
      • getPointOnObject

        public java.awt.Point getPointOnObject()
      • getPointToClick

        protected java.awt.Point getPointToClick(java.awt.Rectangle screenRect)
        Find a clickable point for this object within the given screen rectangle.
      • getMethodSpecForPoint

        public com.rational.test.ft.sys.MethodSpecification getMethodSpecForPoint(java.awt.Point pt)
        Description copied from class: HtmlProxy
        Return a MethodSpecification for a method that returns a java.awt.Point for the specified coordinates. By default a method specification for IGraphical.getScreenPoint will be returned. However, if a proxy can fin
        Overrides:
        getMethodSpecForPoint in class HtmlProxy
        See Also:
        MethodSpecification
      • getActionArgs

        protected java.util.Vector getActionArgs(java.awt.Point point)
        Generate the action argument for the screen point. This method is called by the processMouseEvent implementation in this class. Subclasses should override this and substitute the corresponding ISubItem object(s). The default implementation generates a java.awt.Point which is relative to the upper left of the object as the single argument.
        Parameters:
        point - point in screen coordinates
        Returns:
        a vector containing the appropriate subitem arguments.
      • getDefaultActionArgs

        protected java.util.Vector getDefaultActionArgs(java.awt.Point point)
      • clickWithOutMouse

        public boolean clickWithOutMouse()
      • clickWithOutMouse

        public boolean clickWithOutMouse(long handle)
      • clickWithOutMouse

        public boolean clickWithOutMouse(com.rational.test.ft.script.MouseModifiers modifiers)
      • clickWithOutMouse

        public boolean clickWithOutMouse(com.rational.test.ft.script.MouseModifiers modifiers,
                                         java.awt.Point pt)
      • clickWithOutMouse

        public boolean clickWithOutMouse(com.rational.test.ft.script.MouseModifiers modifiers,
                                         long handle)
      • clickWithOutMouse

        public boolean clickWithOutMouse(com.rational.test.ft.script.MouseModifiers modifiers,
                                         java.awt.Point pt,
                                         long handle)
      • clickWithOutMouseN

        public boolean clickWithOutMouseN(long handle)
      • getTargetChildItem

        public HtmlGuiProxy getTargetChildItem(java.lang.String childTagName,
                                               java.lang.String property,
                                               java.util.ArrayList propertyValues)
      • getTargetChildItem

        public HtmlGuiProxy getTargetChildItem(HtmlProxy proxy,
                                               java.lang.String childTagName,
                                               java.lang.String property,
                                               java.util.ArrayList propertyValues)
      • getTargetChildItems

        public java.util.ArrayList getTargetChildItems(java.lang.String childTagName,
                                                       java.lang.String property,
                                                       java.util.ArrayList propertyValues)
      • getTargetChildHandles

        public java.util.ArrayList getTargetChildHandles(java.lang.String childTagName,
                                                         java.lang.String property,
                                                         java.util.ArrayList propertyValues)
      • getChildrenHandlesMatchingProperty

        public java.util.ArrayList getChildrenHandlesMatchingProperty(java.lang.String propertyName,
                                                                      java.util.ArrayList propertyValues)
      • getVisualClippableParent

        protected com.rational.test.ft.domain.ProxyTestObject getVisualClippableParent()
        Overrides:
        getVisualClippableParent in class com.rational.test.ft.domain.ProxyTestObject
      • performAction

        public boolean performAction(long handle,
                                     java.lang.String action,
                                     java.lang.String text,
                                     boolean isWebPlayer)
      • getScreenSnapshot

        public java.lang.String getScreenSnapshot()
      • performWindowAction

        public boolean performWindowAction(long handle,
                                           java.lang.String action,
                                           java.lang.String text,
                                           boolean isWebPlayer)
      • performClick

        public boolean performClick(com.rational.test.ft.script.MouseModifiers modifiers)
      • performClick

        public boolean performClick(com.rational.test.ft.script.MouseModifiers modifiers,
                                    java.awt.Point pt)
      • performDoubleClick

        public boolean performDoubleClick(com.rational.test.ft.script.MouseModifiers modifiers)
      • performSetText

        public boolean performSetText(java.lang.String text)
      • performSelect

        public boolean performSelect(java.lang.String item)
      • getMappableDocument

        public com.rational.test.ft.domain.ProxyTestObject getMappableDocument()