Forum Discussion

sridharp_mcf's avatar
sridharp_mcf
Contributor
16 years ago

click on Buttons in a web page

Hi,





How to Find no. of buttons exists in a page and click on a specified button name through VBscript



sridhar p

5 Replies


  • Hi Sridhar,





    The script below works with a Google page. It specifies a search parameter on the page and clicks the 'Google Search' button if it exists:



    Sub Test

      ' Open IE before executing the script

      Dim iexplore

      Dim page

      Dim cell

      Dim textbox

      Set iexplore = Sys.Process("iexplore")

      Call iexplore.ToURL("http://www.google.com/")

      Set page = iexplore.Page("http://www.google.com/")

      Set cell = page.Form("f").Table(0).Cell(0, 1)

      Set textbox = cell.Panel(0).Textbox("q")

      Call textbox.SetText("TestComplete")

      If cell.WaitSubmitButton("btnG", 3000).Exists Then

        cell.SubmitButton("btnG").Click

      End If

    End Sub

  • Hi David





    Thanks, i will try this script with different websites, and is there any way to find with a short script instead of this lengthy code.

    Is there any way to find Children of a current page and separetes those with using any property in to a variable.







    Sridhar P