How does the DoClick( ) method differ from the standard Click() method and can SilkTest automatically record DoClick?
The Click() Method simulates a physical click with the mouse peripheral on an x, y co-ordinate on the window screen space. When used in connection with an object, SilkTest automatically calculates where on the screen the object is and performs the click in that location for the object, which normally triggers the action that manually clicking on the object would perform. However, this simulation is not a true recreation of the manually performed click, as it is sometimes hampered by layers which are present in the "simulation mode" when SilkTest performs the action.
The DoClick() Method, is only available under IE DOM for objects of HtmlLink, HtmlImage or HtmlPushButton class type. These classes have a built in "DoClick" function associated with them, which SilkTest hooks into to simulate the manual click, directly on the object itself, rather than a general, window screen space "click".
Regarding the possibility of having SilkTest automatically record DoClick() instead of Click(), it is possible to force SilkTest to record DoClick against HtmlLinks.
Extend the class as follows:
[-] winclass HtmlImage: HtmlImage
[-] boolean Click(INTEGER iButton optional, INTEGER x optional, INTEGER y)
[ ] print("here")
[ ] DoClick()
DoClick() information from SilkTest online help:
HtmlLink class, HtmlImage, and HtmlPushButton for Internet Explorer DOM only. For Netscape 6, the DoClick() method works only for menus and controls on the Netscape Navigator 6 toolbar.
Calls the DOM Click() method on an HtmlLink, HtmlImage, or HtmlPushButton, instead of simulating a physical mouse click.
Use the DoClick() method instead of Click() in cases in which the Click() method cannot successfully click an HtmlLink, HtmlImage, or HtmlPushButton. (In some cases, the Click() method may not be able to find the location of these items; use DoClick() in such situations.) Note that if an x or y coordinate of 0 is passed to the Click method, DoClick is called automatically.
DoClick() is not implemented for SilkTest International.
The following example clicks an HtmlPushButton declared as Enter.