【发布时间】:2019-04-23 16:02:09
【问题描述】:
有一个网站,我已经登录。我无法在登录表单的输入框中输入内容。
我试图获取带有标签名称“输入”的关联对象,但我无法检索它。
Dim ie As InternetExplorerMedium
Dim HTML As HTMLDocument
Dim HTML1, HTML2 As HTMLDocument
URL = "xxxx"
Set ie = New InternetExplorerMedium
ie.Visible = True
ie.navigate URL
Do While ie.readyState <> READYSTATE_COMPLETE Or ie.Busy: DoEvents: Loop
Set HTML = ie.document
Set HTML1 = HTML.getElementById("_id0")
Debug.Print HTML.getElementByTagName() '-----------------------------------------Not able to get the tag name
Call HTML1.getElementById("logon:").setAttribute("value", "username") '---------Neither able to update the username & password too
这是页面的检查元素
【问题讨论】:
-
尝试使用完整 ID“_id0:Logon:CMS:row”的 getElementByID
-
感谢您调查我的请求。同样的问题再次出现。运行时错误 91 对象变量或未设置块变量。
-
将结果分配给 Range 并使用 .Find() 设置范围。如果什么也没找到,那么 Range() 将是 Nothing。见链接:stackoverflow.com/questions/52504282/…