找回密码
 加入
搜索
查看: 1513|回复: 3

[网络通信] [已解决]IE模拟输入不能触发搜索

[复制链接]
发表于 2018-6-10 16:22:54 | 显示全部楼层 |阅读模式
本帖最后由 繁星 于 2018-6-26 00:23 编辑

如下内嵌IE模拟设置keyword的值为112可以,但不能触发JS实现即时搜索,请问应该怎么处理
F12查看了下INPUT有3个事件focus,input,keydown不懂JS
[mw_shl_code=applescript,true]#include <IE.au3>
$Form1 = GUICreate("demo", 540, 485)
$oIE = ObjCreate("Shell.Explorer.2")
GUICtrlCreateObj($oIE, 0, 0, 680, 610)
_IENavigate($oIE, 'http://dhxy.163.com/web/calculator/kj.html?from=dhxy_web')
_IELoadWait($oIE)
GUISetState(@SW_SHOWNORMAL)
Sleep(1000)
$oIE.document.getElementById("keyword").value = '112'

While 1
                Sleep(1)   
        If GUIGetMsg() = -3 Then Exit
WEnd[/mw_shl_code]
发表于 2018-6-10 18:30:07 | 显示全部楼层
没有触地事件啊,如果你手动输入应该是会触发 keydown 事件吧,你直接赋值不会执行键盘按下事件啊。
发表于 2018-6-25 23:34:36 | 显示全部楼层
#include <IE.au3>
#include "array.au3"
$Form1 = GUICreate("demo", 540, 485)
$oIE = ObjCreate("Shell.Explorer.2")
GUICtrlCreateObj($oIE, 0, 0, 680, 610)
_IENavigate($oIE, 'http://dhxy.163.com/web/calculator/kj.html?from=dhxy_web')
_IELoadWait($oIE)
GUISetState(@SW_SHOWNORMAL)
Sleep(1000)

$aaa=$oIE.document.getElementById("keyword")   ;获取对象


    _IEPropertySet($aaa, "innertext", "112")   ;插入文本
   

While 1
        Sleep(1)   
        If GUIGetMsg() = -3 Then Exit
WEnd
 楼主| 发表于 2018-6-26 00:23:02 | 显示全部楼层
fang5072546 发表于 2018-6-25 23:34
#include
#include "array.au3"
$Form1 = GUICreate("demo", 540, 485)

感谢,如此简单,都没搞明白,我地好好看看IE浏览器UDF,
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-28 05:37 , Processed in 0.078586 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表