以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  【已解决】[摸索中]模拟网页点击  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=132416)

--  作者:zto001
--  发布时间:2019/3/21 14:05:00
--  【已解决】[摸索中]模拟网页点击
按照ID来模拟
Dim web As System.Windows.Forms.WebBrowser = e.Form.Controls("WebBrowser1").Basecontrol
web.ScriptErrorsSuppressed = True
Do Until web.ReadyState = 4
    Application.DoEvents
Loop

Dim btn = web.Document.GetElementById("allOperatorLog")
btn.InvokeMember("click")


按照模块中某个元素来获取
Dim web As System.Windows.Forms.WebBrowser = e.Form.Controls("WebBrowser1").Basecontrol
web.ScriptErrorsSuppressed = True
Do Until web.ReadyState = 4
    Application.DoEvents
Loop

Dim inputs = web.Document.GetElementsByTagName("div")
For Each Input As object In Inputs
    If Input.GetAttribute("data-type") = "orderInfo"
        Input.InvokeMember("click")

    End If
Next
[此贴子已经被作者于2019/3/21 15:33:03编辑过]

--  作者:zto001
--  发布时间:2019/3/21 14:33:00
--  

摸索失败,只有部分做到了,但是其他的没做到。最下面那个黄色的保存按钮怎么写?

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:新建文件夹.zip


--  作者:zto001
--  发布时间:2019/3/21 14:33:00
--  
这个文件是网页
--  作者:有点甜
--  发布时间:2019/3/21 14:44:00
--  

参考

 

Dim web As System.Windows.Forms.WebBrowser = forms("窗口1").controls("webbrowser1").Basecontrol
Dim Inputs As object = web.Document.GetElementsByTagName("input")
For Each Input As object In Inputs
    If Input.GetAttribute("value") = "保存"
        msgbox(1)
        Input.InvokeMember("click")
    End If
Next