本帖最后由 ken0137 于 2011-2-23 14:10 编辑
是这样的,一开始是个登陆界面,登陆后跳转到另外一个页面
是不是先要_IEAttach 这个跳转的页面,然后使用_IEFrameGetObjByName得到所有的feame
是不是这样,$UserName='xxx'
$Pwd='ppp'
$oIE = _IECreate("http://www.com")
$oForm=_IEFormGetObjByName($oIE,'form1')
$TxtUserName= _IEFormElementGetObjByName ($oForm, "TxtUserName")
_IEFormElementSetValue($TxtUserName,$UserName)
$TxtPassword= _IEFormElementGetObjByName ($oForm, "txtPassword")
_IEFormElementSetValue($TxtPassword,$Pwd)
$oSubmit= _IEGetObjByName ($oForm, "BtnLogon")
_IEAction($oSubmit,"click")
这样就登陆了,然后在同一页面中等待跳转sleep(10000)
$oIE=_IEAttach("xxxxx有限公司ERP","title")
$oFrameMain = _IEFrameGetObjByName($oIE, "Header")
下面的代码可以取得input的属性$xs = _IETagNameGetCollection ($oFrameMain, "input")
For $x In $xs
MsgBox(0, "Form Input Type", "Form: " & $x.form.name & " Type: " & $x.id)
Next
但是若是改成其他元素的对象,就不能取到值了,例如
$xs = _IETagNameGetCollection ($oFrameMain, "input")
变为
$xs = _IETagNameGetCollection ($oFrameMain, "div")
我想点击head.aspx中<li 这里的
<li style="vertical-align:middle"><a style="zoom:1;vertical-align:baseline;" id='module_02' href="#" onclick="ClickMenu('02')">
业务中心/ My Job
的按钮,但是不知道怎么做,赐教!
下面是head.aspx的代码<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
无标题页
</title><link rel="stylesheet" type="text/css" href="App_Themes/Styles/topFrame.css" />
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<script type="text/javascript" language="javascript">
var isInit = false;
var selectedModuleId = '01';
var selectedMenuId = '';
var paramString = '';
function ClickMenu(moduleId)
{
ShowStyle(moduleId);
ClickMenu2(moduleId);
}
function ClickMenu2(moduleId)
{
if(top.Left.document.readyState != 'complete')
{
setTimeout('ClickMenu2('+ moduleId + ');', 100);
return;
}
var menu = top.Left.document.getElementById('menu_' + moduleId);
var menu2 = top.Left.document.getElementById('menu2_' + moduleId);
var hdn = top.Left.document.getElementById('hdnIsSetHeaderStyle');
if(menu != null && menu2 != null && hdn != null)
{
hdn.value = '1';
if(menu.style.display == 'none')
{
menu2.click();
}
else
{
menu.click();
}
}
}
function Init()
{
var tempModule = document.getElementById('module_' + selectedModuleId);
if(tempModule != null)
{
isInit = true;
tempModule.click();
isInit = false;
}
}
function ShowStyle(newModuleId)
{
var oldId = 'module_' + selectedModuleId;
var newId = 'module_' + newModuleId;
var oldModule = document.getElementById(oldId);
var newModule = document.getElementById(newId);
if(oldModule != null)
{
oldModule.className = '';
}
if(newModule != null)
{
newModule.className = 'selected';
}
selectedModuleId = newModuleId;
}
function ClickHomePage()
{
top.document.getElementById('Right').src = 'Index.aspx?rdm=' + Math.random();;
}
function Logout()
{
top.window.location = 'Logon.aspx?usbguid=' + document.getElementById('hflUsbGuid').value;
}
//left.aspx用来设置header.aspx中选中模块的样式
function SetModuleStyle()
{
var hdn = document.getElementById('hdnNewModuleId');
if(hdn != null)
{
if(hdn.value != -1)
{
ShowStyle(hdn.value);
}
}
}
function ShowMustKnow()
{
window.showModalDialog('html/MustKnow.htm?random=' + Math.random(),document,'dialogHeight: 630px; dialogWidth: 750px;edge: Raised; center: Yes; help: No; resizable: Yes; status: No;scrollbars:auto');
}
</script>
</head>
<body onload="Init();">
<form name="form1" method="post" action="Header.aspx?usbguid=&moduleId=01&menuId=" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTc2Njc2NjczMg9kFgICAw9kFgJmDxYCHgtfIUl0ZW1Db3VudAIDFgZmD2QWAmYPFQMJbW9kdWxlXzAxD0NsaWNrTWVudSgnMDEnKRzmtojmga/kuK3lv4MvIE1lc3NhZ2UgQ2VudGVyZAIBD2QWAmYPFQMJbW9kdWxlXzAyD0NsaWNrTWVudSgnMDInKRTkuJrliqHkuK3lv4MvIE15IEpvYmQCAg9kFgJmDxUDCW1vZHVsZV8wMw9DbGlja01lbnUoJzAzJykU572R5LiK5ZWG5Z+OLyBFLVNob3BkZGiGsXVp5njaAgfZneKE6GOdQ3Y9" />
</div>
<div id="HBG">
<div id="logo">
</div>
<div id="welcome">
<p>
欢迎你,张婕</p>
<p>
<a href="#" onclick="window.showModalDialog('./UC/ORG/PassWord.aspx',window,'dialogHeight:225px; dialogWidth:330px; dialogTop:150px; dialogLeft:300px; edge:Raised; center:Yes; help:No; resizable:Yes; status:Yes;');">修改密码</a> | <a href="#" onclick="Logout();">退出</a></p>
</div>
</div>
<div id="mainNav">
<ul>
<li style="vertical-align:middle"><a style="zoom:1;vertical-align:baseline;" id='module_01' href="#" onclick="ClickMenu('01')">
消息中心/ Message Center
</a>
<img src="App_Themes/Images/line.gif" width="2" height="16" />
</li>
<li style="vertical-align:middle"><a style="zoom:1;vertical-align:baseline;" id='module_02' href="#" onclick="ClickMenu('02')">
业务中心/ My Job
</a>
<img src="App_Themes/Images/line.gif" width="2" height="16" />
</li>
<li style="vertical-align:middle"><a style="zoom:1;vertical-align:baseline;" id='module_03' href="#" onclick="ClickMenu('03')">
网上商城/ E-Shop
</a>
<img src="App_Themes/Images/line.gif" width="2" height="16" />
</li>
</ul>
</div>
<input type="hidden" name="hflUsbGuid" id="hflUsbGuid" />
<input type="hidden" id="hdnNewModuleId" value="-1" />
<input type="button" id="btnShowNewModuleStyle" onclick="SetModuleStyle();" style="display:none;" />
</form>
</body>
</html>
接下来想要点击“业务中心”这个按钮,要如何才能取得呢? |