我正在检索一个活动的Internet Explorer选项卡,以便为经过身份验证的站点运行自动化脚本 . 我需要将应用程序实例本身作为操作的东西,因为我有办法导航到我想要的页面,因为按钮没有ID来调用它 .
我首先在这里找到正确的页面,然后从那里开始顺利 .
Dim oShell, oWSHShell, sTitle, wndw, bMatch, oSelect
set oShell =createobject("shell.application")
set oWSHShell = createobject("wscript.shell")
sHTMLTitle = "Add Account"
bMatch =false
for each wndw in oShell.windows
if instr(lcase(typename(wndw.document)), "htmldocument") > 0 then
sTitle =wndw.document.title
if Instr(sTitle, sHTMLTitle)<> 0 then
bMatch =true
exit for
end if
end if
next
有没有办法可以保存oShell对象作为我以后可以参考的内容?我发现用于声明IE对象的任何引用都是为了创建一个在这里不起作用的全新窗口,因为您必须重新验证自己并破坏整个目的 .
1 回答
如果我理解正确,那么根据您的评论,我认为您走在正确的轨道上 .
wndw
是您的IE对象 . 但是在分配对象引用时需要使用Set
关键字 . 例如: