在auto中提交表单

时间:2015-08-14 17:58:45

标签: html autocomplete automation autoit

问题是: 我的html格式包含: -

"two text-box"" bottom to submit"

我想要的是: 使脚本自动添加一些文本并提交表单,而无需打开Internet Explorer窗口(只是脚本)。

我试图实现get和post,但它失败了

#include<ie.au3>
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", "http://localhost/2.html", False)
_IELinkClickByText( $oHTTP , "submit")
$oHTTP.Send()

2 个答案:

答案 0 :(得分:0)

您可以使用WinHttp.au3执行此操作 - https://www.autoitscript.com/forum/topic/84133-winhttp-functions/ 检查填写表单的_WinHttpSimpleFormFill,然后提交

答案 1 :(得分:0)

带有“_IE”前缀的函数不用于WinHttp对象。因此,您无法调用 _IELinkClickByText 函数。

使用IE UDF提交表单的示例:

#include <IE.au3>
Local $oIE = _IECreate('http://localhost/2.html')
Local $oForm = _IEFormGetCollection($oIE, 0)
_IEFormSubmit($oForm)

但是如果你想使用WinHttp,你应该使用 POST 方法而不是 GET