Reflection Desktop VBA Guide
Attachmate.Reflection.Objects Library / Attachmate.Reflection.Objects.Web.Msie Library / WebElement Object / Click Method
Example
In This Topic
    Click Method
    In This Topic
    Clicks the link, if the Web element is a link.
    Syntax
    expression.Click() 
    where expression is a variable that represents a WebElement Object
    Example
    This example navigates to a Web page and clicks on a link in the page. To run this sample, create and open a Web session and run this code in the session code module.
    Sub webClick()
        
        'Declare variables:
        Dim wControl As Attachmate_Reflection_Objects.WebControl
        Dim wDocument As WebDocument
        Dim wElement As WebElement
        Dim wElementInput As WebElement    
     
        Set wControl = ThisWebControl
        
        'Get a handle to the workspace
        Set app = GetObject("Reflection Workspace")
     
        'Go to the Host Access Analyzer documentation page
        wControl.Navigate1 ("https://www.microfocus.com/documentation/host-access-analyzer/")
                
        'Wait until the Web page is ready and then set it as the Web document
        Do Until wControl.ReadyState = WebBrowserReadyState_Complete
          app.Wait (1000)
        Loop
        
        Set wDocument = wControl.Document
        
        'Get the table that includes the link
        Set wElement = wDocument.GetElementById("getting_started")
        
        'Get the link element
        Set wElementInput = wElement.GetElement("tbody/tr[0]/td[0]/a[0]")
     
        
        'Click the link
        wElementInput.Click
        
        'Print the tag name of the element
        Debug.Print wElementInput.tagName
        
    End Sub
    See Also