我一直试图在工作中刮除Intranet网站,这比我愿意接受的时间更长。该程序是使用IE的Agile(常见的制造工具),因此在导航时地址不会更改。我要选择的选项卡/按钮/菜单位于tab_wrapper内,我无法使用我的技能设置。
我能钻到的最远的是...
idoc.getElementById("rightPaneContent").getElementsByTagName("Form")(0)
...但是对于DIV,LI或A来说并没有显示完整的结果。
我要选择的菜单下拉菜单实际上是多余的,但是菜单栏使用了没有类或ID的HREF javascript,我也试图在没有任何运气的情况下执行该菜单,因此我将注意力转向了ID的下拉菜单
Private Sub btnSearch_Click()
Dim page, srch As String
srch = Me.txtSearch
page = "http://xxagile.xxxxxx.com/Agile/" & _
"PLMServlet?module=LoginHandler&opcode=forwardToMainMenu#"
Dim ie As InternetExplorer: Set ie = New InternetExplorerMedium
With ie
.Visible = True
.Navigate page
End With
Do Until ie.ReadyState = 4: DoEvents: Loop
Dim iDoc As HTMLDocument: Set iDoc = ie.Document
With iDoc
.getElementById("toggle_search_menu").Click ' select menu
.getElementById("cls_901").Click ' select ITEM from menu
.getElementById("quicksearch_string").Value = srch ' enter string
.getElementById("top_simpleSearch").Click ' click search button
End With
Do Until ie.ReadyState = 4: DoEvents: Loop
'iDoc.getElementById("rightMenuImg").Click ' error 91
'iDoc.getElementById("rightScrollMenu").Click ' error 91
With ie
'.Stop
'.Quit
End With
Set ie = Nothing: Set iDoc = Nothing
End Sub
outerHTML大约有1600多行,因此我将其缩短为...
<div id="rightpanecontent">
<form name="MainForm" method="POST" action="PCMServlet" enctype="application/x-www-form-urlencoded" onsubmit="return false;" target="_self">
<!--************************************
TAB VIEW
*************************************-->
<div id="tabsview_wrapper">
<div id="tabsandcontrols"> <!-- wrapper for tabs, dms, and tab actions -->
<!--************************************
TABS
*************************************-->
<div id="leftScroll" style="display: none; left: 129px; top: 174px;">
<div id="rightScroll" style="display: none; left: 528px; top: 174px;">
<img id="rightScrollImg" src="/Agile/static/6dbe07cad9d304865dea9dfd18d4cb59/images/icn_action_tabscroll_right_enabled.png" onmousedown="scrollButtonPressed(event, 'right')" onmouseup="hideShowScrollButtons()" oncontextmenu="return false" style="cursor: pointer;">
</div>
<div id="rightScrollMenu" style="display: block; left: 891px; top: 142px;">
<img id="rightMenuImg" src="/Agile/static/8913d52dc8a2aeaaa1ea83e36663943d/images/icn_action_tabmenu.png" onclick="showTabsMenu(this, '21', event)" ondblclick="showTabsMenu(this, '21', event)" style="cursor: pointer;">
</div>
我尝试了许多编码变化。射击,点击,嵌套,聚焦等,我就在尽头。
答案 0 :(得分:0)
尤里卡时刻...
Dim sJS As String
sJS = "javascript:displayObject" & _
"('ItemHandler', '10000', '394341431', '12','', '0');"
Call iDoc.parentWindow.execScript(sJS)