0

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>

3 Answers 3

1

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

Sign up to request clarification or add additional context in comments.

Comments

1

Sorry my mistake.

IE.Document.All.Item("addButton").Click works fine, but i was in the wrong frame ...

Comments

0
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

1 Comment

Welcome to Stack Overflow! Please remember to make sure you format your code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.