Results 1 to 2 of 2

Thread: Html Button clicking help

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2011
    Posts
    1

    Html Button clicking help

    Okay well I have been trying to make a visual basics program that buys a product when it is available. So the program inserts the text box product number into the form and then clicks check availability, without reloading the page, a second button appears if the product on the website is available. And then the second button is then clicked. If the second button doesn't exist yet the program loops and starts over again until the second button is available. This code is currently what I have. The program begins to loop and then freezes. Any help would be appreciated.

    What I have so far
    Code:
      WebBrowser2.Document.GetElementById("product").SetAttribute("value", TextBox3.Text)
      Do Until WebBrowser2.DocumentText.Contains("button id=""BuyIt""")
        WebBrowser2.Document.GetElementById("checkAvailability").InvokeMember("click")
      Loop
    
      WebBrowser2.Document.GetElementById("BuyIt").InvokeMember("click")
    These are the buttons
    Code:
    <button id="checkproduct" type="submit" style="display: inline"> Check Availability of Product </button>
    <button id="buyIt" type="submit" style="display: none"> Buy it </button>

  2. #2
    Fanatic Member
    Join Date
    Oct 2011
    Location
    Sydney, Australia
    Posts
    756

    Re: Html Button clicking help

    seems like it will click something until it appears, cant you put something along these lines
    Code:
    do until browser.readystate = 4 'or "complete"
    loop
    browser is what you have called it (WebBrowser2)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width