我正在尝试自动点击IE中的按钮而没有任何成功。任何帮助,将不胜感激。该网页是一个公共搜索网站:https://eams.dwc.ca.gov/WebEnhancement/
该页面上有一些需要输入文本框和三个按钮。按钮是:取消,重置和下一步。
我填写字段并单击“下一步”按钮的代码:
oIE = CREATEOBJECT([InternetExplorer.Application])
oIE.Navigate([https://eams.dwc.ca.gov/WebEnhancement/])
oie.visible = .t.
oie.document.forms[0].elements[0].value='somebodys first name'
oie.document.forms[0].elements[1].value='somebodys last name'
oie.document.forms[0].elements[3].value='some email'
oie.document.forms[0].elements[4].selectedindex = 2
?oie.document.forms[0].elements[7].value && displays Next
oie.document.forms[0].elements[7].click && does not work
oie.document.forms[0].submit && does not work
inputCollection = oie.document.getElementsByTagName("input")
?inputcollection.item[6].value && displays Next
inputcollection.item[6].click() && does not work.
查看来源包含:
<div id="wrapper">
<p align ="center" class="pageTitleLayout" >Requestor information capture</p>
<form id="requestor" action="InformationCapture" method="post">
<table align='center'>
...
...
<tr>
<th>
<input type="submit" name="action" value="Cancel" >
<input type="submit" name="action" value="Reset" >
<input type="submit" name="action" value="Next" >
</th>
</tr>
</table>
</form>
</div>
谢谢!
答案 0 :(得分:0)
我终于明白了。以下代码相当于单击“下一步”按钮: oIE.Document.forms [0] .submit(3) 解决方案是将3作为参数传递给Submit方法。