Reputation: 11
Can someone give me a hint, how to click the buttons (the addButton)?
Tryed something like
IE.Document.All.Item("addButton").Click
(and more) but that does not work.
HTML Code:
<form action="./snfDestServlet" method="post" id="destForm" enctype="multipart/form-data" accept-charset="UTF-8">
<div id="destBox" class="indented"><select id="destinations" size="6" name="dests">
<option value="scanToNet.factory.9">MDS</option>
<option value="scanToNet.factory.11">Host1-SMB</option>
<option value="scanToNet.factory.10">Host2-SMB</option>
</select>
</div>
<div id="destinationButtons">
<input type="submit" name="addButton" value="Hinzufügen..."></input>
<br></br>
<input type="submit" name="editButton" value="Bearbeiten..."></input>
<br></br>
<input type="submit" name="deleteButton" value="Löschen"></input>
</div>
<br class="clear"></br>
Upvotes: 0
Views: 13751
Reputation: 54
Dim IE
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = 1
IE.FullScreen = 0
IE.navigate "www.anything.com"
Do While (IE.Busy)
WScript.Sleep (10)
Loop
IE.Document.getElementById("Button_ID").click
Upvotes: 0
Reputation: 11
Sorry my mistake.
IE.Document.All.Item("addButton").Click works fine, but i was in the wrong frame ...
Upvotes: 1
Reputation: 1472
Please refer to my answer in the following thread:
How to click a Link on a webpage using VBScript
For this scenario you can use the method "getElementById". For example:
IE.Document.getElementById("destinationButtons").Click
So your code will look something like:
Dim URL
Dim IE
Set IE = CreateObject("internetexplorer.application")
URL = "http://whateverURLyouWant.com"
IE.Visible = True
IE.Navigate URL
Do While IE.Busy
WScript.Sleep 100
Loop
IE.Document.getElementById("destinationButtons").Click
There are also other methods you can use to access and click elements on a page, I refer to the following for a list:
http://msdn.microsoft.com/en-us/library/ie/ms535862(v=vs.85).aspx
Upvotes: 1