Button with no name IE automation
Perfect!
That array works well. I will work on maybe trying to check the button text
before I click for error checking but for now I can click things at least.
Thanks
"Joel" wrote:
Use the tag "A". The 3 buttons are found under the ag A and you should be
able to use index to A. I don't program in scripting but in VBA macro code I
would do something like this
Set Buttons = IE.document.getelementsbytagname("A")
Then you will have an array starting a index zero for each object
button(0)
button(1)
button(2)
"David" wrote:
Hello
I cannot find the answer to this question anywhere. Please help.
I am using IE automation in Excel to grab information from different sites.
For the first time I have come across a website that uses buttons without
naming them. I have an example code below. I would like to automate clicking
the View Forms button. There seems to be no information to grab in order to
isolate the button and click on it
Anyone got any ideas?
Thanks
David
<html
<head
...
function SubmitForm() {
if (CSValidation()) {
pop('?lang=en'); document.GEOptions.submit();
}
}
function ResetForm() {
pop('?lang=en'); document.GEOptions.submit();
}
function HiliteControlContents() {
// alert(event.srcElement.type);
event.srcElement.select();
}
//--
</script
<script language='JavaScript' type='text/javascript'<!--
function CSValidation() {
var bRv = true;
return bRv;
}
//--</script
</head
<body onload="unpop();"
<div id="container"
<div id="header"
<img id="logo_en" src="images\header.jpg"
</div
<div id="content"
<form name="GEOptions" method="post"
action="GEOptions.aspx?lang=en&st=sl&sesid=" id="GEOptions"
<input type="hidden" name="__VIEWSTATE"
value="dDwxMjAzMTM2NjU1Ozs+LAMHbXDQNveW/O6OLl+hxQiw32M=" /
<span id="XMLSessionMgr"</span
<input type='hidden' id='SesID' name='SesID' value='' /<input type='hidden'
id='DebugID' name='DebugID' value='21' /
<input type=hidden id="button" name="button"
<table
<tr
<td colspan="2" align="left"
<h1Options Menu</h1
</td
</tr
<tr
<td
<div class="ButtonBox"
<div class="Button"
<a href="javascript:document.GEOptions.button.value=' newform';SubmitForm();"
<div class="ButtonText"New Form</div
</a
</div
</div
</td
<td <h2Create a new Form</h2 </td
</tr
<tr
<td
<div class="ButtonBox"
<div class="Button"
<a
href="javascript:document.GEOptions.button.value=' editform';SubmitForm();"
<div class="ButtonText"Edit Form</div
</a
</div
</div
</td
<td
<h2Edit an existing form in user tools</h2
</td
</tr
<tr
<td
<div class="ButtonBox"
<div class="Button"
<a
href="javascript:document.GEOptions.button.value=' viewforms';SubmitForm();"
<div class="ButtonText"View Forms</div
</a
</div
</div
</td
<td
<h2View all forms in spreadsheet view</h2
</td
</tr
</body
</html
|