Take the 2-minute tour ×

I am trying to write a script to drive my IExplorer. It works okay up to a point but then I need to enter a value in a textarea and click a button while they both have no ID. I have no idea how I can move arround in the HTML DOM using VBScript but it was suggested somewhere to use document.all somehow. I was also thinking of maybe using a JS script to give them IDs and then go back and use document.getElementbyid but I don't know how to run a JS script from within the VBScript with the initialised document object in mind. What I have so far is:

Option Explicit
With CreateObject("InternetExplorer.Application")
  .Visible = True
  .Navigate "https://adwords.google.co.uk/um/Logout"
  Do While .Busy
WScript.Sleep 100
  .Document.getElementByID("Email").Value = "testtestingtton@gmail.com"
  .Document.getElementByID("Passwd").Value = "PWD"
  'Note: You could just get the form and submit it, but
  'you'll miss out on any special JavaScript associated 
  'with the Submit button.
  Do While .Busy
    WScript.Sleep 100
      .Navigate "https://adwords.google.co.uk/o/Targeting/Explorer?"
        Do While .Busy
    WScript.Sleep 100
'here begins the problem'
  .Document.All.tags("sB5 sPEB").Value = "southpark"

End With

Also since the field I am trying to fill is

<textarea style="overflow-y: hidden; height: 36px;" class="sB5 sPEB"></textarea>

and it has no value attribute how is its value inputed?

share|improve this question
You may be using IE 8 or previous version. getElementsByClassName() not supported by IE DOM. Please Check This quirksmode.org/dom/w3c_core.html –  4M01 Mar 30 '12 at 9:57

2 Answers 2

Use XML DOM methods such as hasChildNodes and nextNode to move around. The text value is stored as a child of the textarea element in a text node.

share|improve this answer

instead of using .Document.All.tags("sB5 sPEB").Value = "southpark"

Try below codes

  1. check if the class is unique

    .Document.getElementsByClassName("sB5 sPEB").Value = "southpark"

Otherwise use a for loop and with if statement send value

share|improve this answer

Your Answer


