Scripting Question

Press a button inside an already opened IE

06/07/2015 2785 views
Hello. I have a script that opens an website then it clicks a button. That button opens a new Internet Explorer with a random URL. Every new Internet Explorer will have a button called:
So what I really want. My VBScript opens that page, then it will press that button and then I want to press that

in that new Internet Explorer.

This is my script so far:

Set IE = createobject("internetexplorer.application") 
strURL = "website"

Do While True
IE.navigate strURL 
IE.Visible = true   
Do While (IE.Busy Or IE.READYSTATE <> 4)    
    WScript.Sleep 1000
    Set Popupbutton = IE.Document.GetElementsByClassName("btn3")
    for each button in Popupbutton
       WScript.Sleep 5000
    exit for
    WScript.Sleep 5000

The above script will press the button: "btn3" and that button will open a new IE window where there is the button "pagesHeaderLikeButton"

Note that the button is a div type button.

This is the button that my VBscript will press:

<a href="random url">
  <div class="btn3">
    Music I Like

This will open a new IE window in which there is this button I want to press:

<a href="Music.html">
  <div id="pagesHeaderLikeButton">
    Music I Realy Like
0 Comments   [ + ] Show comments


All Answers

It must be easier to work out how the data is being POSTed by the button and then build a string containing that data and sending that to the browser.
Answered 06/10/2015 by: VBScab
Red Belt

  • Yes but this script is part of an IE automation script and the website have antibot. And that's why I need to simulate the human behaviour.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login