Forum Discussion

kaiiii's avatar
kaiiii
Regular Contributor
7 years ago

Click a variable

How can i Click a variable, suppose Dim b b = "Hi How are you"     Now this string is shown on a page....how can i make an object for it so i can use click method
  • jose_pjoseph's avatar
    7 years ago

    Also, if you want to specifically use the variable, and don't mind using xpath, you can do the following:

     

    dim b, obj, xpath
    
    b = "Hi How are you"
    xpath = "//*[text()='" & b & "']"
    Set page = Sys.Browser("*").Page("*")
    Set obj = page.FindChildByXPath(xpath)

    If the variable sting is not unique and there is more than one element in your page with the string, you will have to modify the xpath to get the desired object.