Sign in to follow this  
Followers 0
evering7

How can I access the IE input box in alternative ways?

3 posts in this topic

Dear friends from AutoIt forum,

I am a AutoIt fan in China. And I come across a problem when I tried to set a value of input box in IE using AutoIt script.

The source code of au3 file and corresponding frame html is as attached. I try to set the value of input txt box(id=ShengQingZhe) in the frame in IE, but I can't even get the correct reference to this DOM object of input txt box.

Could anyone give me a clue or suggestion on how to access the input txt box (id=ShengQingZhe)?

I have tried many IE UDF function to access the input box object, but fail to execute and get results. These functions include _IETagNameAllGetCollection, _IETagNameGetCollection, _IEFrameGetObjByName, _IEGetObjByName, _IEGetObjById, _IEFormGetObjByName, _IEFormElementGetObjByName, etc.

I would be very grateful if anyone could help me out.

JF -->

The html source code of webpage

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
</HEAD>
<link rel="stylesheet" href="css/form0.css">
<LINK href="../../css/pub.css" type="text/css" rel="stylesheet">
<script language="javascript" src="js/fc.js" ></script>
<script language="javascript" src="js/pubfunction.js" ></script>
<script language='javascript' src='calendar/script/Popup.js' ></script>
<script language="javascript" src="js/custom.js" ></script>
<script language="javascript" > </script>
<body MS_POSITIONING='GridLayout' onload='initpages();initdynas();' onunload='formunload();'>
<form id='Form1' method='post' action="../pages/getValue.aspx?formname=CXQCZJ_TongYongBiaoDan" name='Form1'>
<table cellspacing=0 class='tableall' align=center ><tr><td class='tdfieldset'><fieldset id='actionarea' class='actionareacss' ><P align=right></P></fieldset></td></tr><tr><td class='tdcontent'><table border=1 id='tab_table' ><tr><td className='taboncss' id='td_CXQCZJ_TongYongBiaoDan_Page_NAPZ1501' onclick="doTabpageClick('tab_table');showpage('pages_div','CXQCZJ_TongYongBiaoDan_Page_NAPZ1501')" >&nbsp&nbsp申请表&nbsp&nbsp</td></tr></table><table width='100%' border='0' bgcolor="#FFFFFF"><tr><td height='20' background="images/ecgapform.gif"></td></tr></table> <div class='formcontent'><Div id='pages_div' ><Div id='CXQCZJ_TongYongBiaoDan_Page_NAPZ1501' ><P align=center><FONT size=5><STRONG>项目申请表</STRONG></FONT></P>
<P align=center><FONT size=5></FONT>&nbsp;</P>
<P align=center><FONT size=5>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=1 borderColorDark=#000000 cellPadding=1 width="100%" borderColorLight=#000000 border=1>
<TBODY>
<TR>
<TD borderColor=#000000 width="15%">
<P align=center>申请者:</P></TD>
<TD borderColor=#000000 width="35%"><INPUT class="" onkeypress="" id=ShenQingZhe onkeydown="" onblur="" ondblclick="" onkeyup="" title="" style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; WIDTH: 99%; BORDER-BOTTOM: 1px solid" onpropertychange="" onfocus="" onclick="" onchange="" name=ShenQingZhe v_maxlength="100" v_must="1" v_name="申请者" elementType="txt"></TD>
<TD borderColor=#000000 width="15%">
<P align=center>申请日期:</P></TD>
<TD borderColor=#000000 width="35%"><INPUT class="" onkeypress="" id=ShenQingRiQi onkeydown="" onblur="" ondblclick="" onkeyup="" title="" style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; WIDTH: 80%; BORDER-BOTTOM: 1px solid" onpropertychange="" onfocus="" onclick="" readOnly onchange="" size=10 name=ShenQingRiQi v_must="0" v_name="申请日期" elementType="date" v_type="date"> <IMG style="CURSOR: hand" onclick="getDate('ShenQingRiQi','rowIndex')" alt=弹出日历下拉菜单 src="images/datetime.gif" align=absMiddle name=img_ShenQingRiQi></TD></TR>
<TR>
<TD borderColor=#000000 width="15%">
<P align=center>联系人:</P></TD>
<TD borderColor=#000000 width="35%">
<P align=center><INPUT class="" onkeypress="" id=LianXiRen onkeydown="" onblur="" ondblclick="" onkeyup="" title="" style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; WIDTH: 99%; BORDER-BOTTOM: 1px solid" onpropertychange="" onfocus="" onclick="" onchange="" name=LianXiRen v_maxlength="100" v_must="0" v_name="联系人" elementType="txt"></P></TD>
<TD borderColor=#000000 width="15%">
<P align=center>联系电话:</P></TD>
<TD borderColor=#000000 width="35%"><INPUT class="" onkeypress="" id=LianXiDianHua onkeydown="" onblur="" ondblclick="" onkeyup="" title="" style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; WIDTH: 99%; BORDER-BOTTOM: 1px solid" onpropertychange="" onfocus="" onclick="" onchange="" name=LianXiDianHua v_maxlength="100" v_must="1" v_name="联系电话" elementType="txt"></TD></TR>
<TR>
<TD borderColor=#000000 width="15%">
<P align=center>联系地址:</P></TD>
<TD borderColor=#000000 width="35%" colSpan=3>
<P align=left><INPUT class="" onkeypress="" id=LianXiDiZhi onkeydown="" onblur="" ondblclick="" onkeyup="" title="" style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; WIDTH: 99%; BORDER-BOTTOM: 1px solid" onpropertychange="" onfocus="" onclick="" onchange="" name=LianXiDiZhi v_maxlength="100" v_must="0" v_name="联系地址" elementType="txt"></P></TD></TR>
<TR>
<TD borderColor=#000000 width="15%">
<P align=center>备注:</P></TD>
<TD borderColor=#000000 width="35%" colSpan=3><TEXTAREA class="" onkeypress="" id=BeiZhu onkeydown="" onblur="" ondblclick="" onkeyup="" title="" style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; WIDTH: 99%; BORDER-BOTTOM: 1px solid; HEIGHT: 135px" onpropertychange="" onfocus="" onclick="" name=BeiZhu rows=7 onchange="" v_must="0" v_name="备注" elementType="area"></TEXTAREA></TD></TR></TBODY></TABLE></FONT></P></div></div></div></td></tr></table>
<input type='hidden' name='docId' id='docId' value=''>
<input type='hidden' name='rtnName' id='rtnName' value=''>
<input type='hidden' name='formid'  value='CXQCZJ_TongYongBiaoDan'>
<input type='hidden' name='signfield1'  value=''>
<input type='hidden' name='signfield2'  value=''>
<input type='hidden' name='businessrelationid'  value=''>
</form>
<script>var titleColStr="";</script>

<script language='javascript'>

var IsLicensePrintConfig = '';
  AcceptSendMessageTip = 'no';
 
var FinishSendMessageTip = '';
  FinishSendMessageTip = 'no';
 
var ShouLiPingYiConfig = '';
  ShouLiPingYiConfig = 'no';
 
var PingYiConfig = '';
  PingYiConfig = 'no';
var LangChao_ECGAP_Signature_SignatureSystem = 'jgkj';
var LangChao_ECGAP_Signature_SignatureServiceUrl = 'http://www.utcsoft.com/utcgetinfo.aspx';
var LangChao_ECGAP_Signature_UserID = '00054';
var LangChao_ECGAP_Signature_UserName = '';
var LangChao_ECGAP_Signature_DeptID = 'inspur001010';
var LangChao_ECGAP_Signature_DeptName = '';
var attString='791a0ed2-57b2-4d05-aac6-1f12d74dff36;;0;1;1;1;1;CXQCZJ_TongYongBiaoDan';var bManualSend = false;var LangChao_ECGAP_InPortal_MessageCenter_bNeedConfirmSendTacheStartMsg = false;var LangChao_ECGAP_InPortal_MessageCenter_bNeedConfirmSendToDoWorkMsg = false;var LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType =  new Array(3);
LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['grantpermit'] = false;
LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['notgrantpermit'] = true;
LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['reportnotgrantpermit'] = true;
var LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType =  new Array(3);
LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['grantpermit'] = false;
LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['notgrantpermit'] = true;
LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['reportnotgrantpermit'] = true;

var PingYiConfig = '';
  PingYiConfig = 'no';
 
var IsLicensePrintConfig = '';
  IsLicensePrintConfig = 'yes';
var LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType =  new Array(3);
LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['grantpermit'] = false;
LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['notgrantpermit'] = true;
LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['reportnotgrantpermit'] = true;

var PingYiConfig = '';
  PingYiConfig = 'no';
 
var IsLicensePrintConfig = '';
  IsLicensePrintConfig = 'yes';
 
var HaveLicensePrint = '';
var LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType =  new Array(3);
LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['grantpermit'] = false;
LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['notgrantpermit'] = true;
LangChao_ECGAP_InPortal_Configuration_FinishAffirmActType['reportnotgrantpermit'] = true;

var PingYiConfig = '';
  PingYiConfig = 'no';
 
var IsLicensePrintConfig = '';
  IsLicensePrintConfig = 'yes';
 
var HaveLicensePrint = '';

function StBody(obj,funStr,ExampleValue){  
if(document.all(obj)){  
document.all(obj).value = ExampleValue;  
var myondblclickvalue =document.all(obj).getAttributeNode("ondblclick").value;  
document.all(obj).ondblclick = new Function(myondblclickvalue+";"+funStr);}}
</script>

<script language='javascript'>
//--------Binding SubForm Data--------
//------End Binding SubForm Data------
//Bind custom data.
if (document.all("ShenQingRiQi")!=null) {document.all("ShenQingRiQi").value=replaceSubstring('2012-11-08',"[br]","\r\n");}
//------End Binding Data------
document.all("docId").value = "00486";
</script>

<script language='javascript'>
//--------Local Action Information--------
document.all("actionarea").innerHTML="";
document.all("actionarea").innerHTML+="<INPUT type=\"button\" name=\"btnSave\" value=\"暂存\" style=\"DISPLAY:\" title=\"\"   class=\"normal-button\" onclick=\"FormSubmit(this.name);\" onmouseout=\"this.className='normal-button';\" onmouseover=\"this.className='mouseover-button';\" >";
document.all("actionarea").innerHTML+="<INPUT type=\"button\" name=\"btnSubmit\" value=\"提交\" style=\"DISPLAY:\" title=\"\"   class=\"normal-button\" onclick=\"WfSubClick2(this.name);\" onmouseout=\"this.className='normal-button';\" onmouseover=\"this.className='mouseover-button';\" >";
document.all("actionarea").innerHTML+="<INPUT type=\"button\" name=\"btnAudit\" value=\"意见\" style=\"DISPLAY:\" title=\"\"   class=\"normal-button\" onclick=\"OpenAudit(this.name);\" onmouseout=\"this.className='normal-button';\" onmouseover=\"this.className='mouseover-button';\" >";
document.all("actionarea").innerHTML+="<INPUT type=\"button\" name=\"btnPrint\" value=\"打印\" style=\"DISPLAY:\" title=\"\"   class=\"normal-button\" onclick=\"FormSubmitPrint(this.name);\" onmouseout=\"this.className='normal-button';\" onmouseover=\"this.className='mouseover-button';\" >";
document.all("actionarea").innerHTML+="<INPUT type=\"button\" name=\"btnbujian\" value=\"补齐补正\" style=\"DISPLAY:\" title=\"\"   class=\"normal-button\" onclick=\"bujian1(this.name);\" onmouseout=\"this.className='normal-button';\" onmouseover=\"this.className='mouseover-button';\" >";
document.all("actionarea").innerHTML+="<INPUT type=\"button\" name=\"btnHalfend\" value=\"中途\" style=\"DISPLAY:\" title=\"\"   class=\"normal-button\" onclick=\"HalfEndFlow();\" onmouseout=\"this.className='normal-button';\" onmouseover=\"this.className='mouseover-button';\" >";
document.all("actionarea").innerHTML+="<INPUT type=\"button\" name=\"btnShouLi\" value=\"\" style=\"DISPLAY:\" title=\"\"   class=\"normal-button\" onclick=\"WfShouLiClick(this.name);\" onmouseout=\"this.className='normal-button';\" onmouseover=\"this.className='mouseover-button';\" >";
document.all("actionarea").innerHTML+="<INPUT type=\"button\" name=\"btnReturn\" value=\"取消\" style=\"DISPLAY:\" title=\"\"   onclick=\"history.back(-1);\" class=\"normal-button\" onmouseout=\"this.className='normal-button';\" onmouseover=\"this.className='mouseover-button';\" >";
//------End Local Action Information------

//-------Custom Script--------
//------End Custom Script-----


document.all("actionarea").innerHTML = ''+document.all("actionarea").innerHTML;
document.all("actionarea").innerHTML = '资格'+document.all("actionarea").innerHTML;//--------Input ACL--------
//------End Input ACL------

</script>

</body>
</HTML>

the AutoIt code I try to continue with feature of accessing the inputbox

#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.6.1
Author:      JianFei
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
#include <IE.au3>
Opt("MustDeclareVars", 1)      ;0=no, 1=require pre-declare
Opt("WinTitleMatchMode", 2)  ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
; http://www.kjjxjy.com/WebAcc/?ver=1
Local $urlStart, $oIE
Local $oForms , $oForm;
Local $oQuery;
$urlStart = "http://10.68.108.16/LangChao.ECGAP.InPortal/login/formlogin.aspx"
$oIE = _IECreate ($urlStart)
; windows position
_IEPropertySet($oIE, "left",0)
_IEPropertySet($oIE, "top",0)
_IEPropertySet($oIE, "width", @DesktopWidth)
_IEPropertySet($oIE, "height", @DesktopHeight)
sleep(2000)
;send("{ENTER}")
;$oForm = _IEFormGetCollection ($oIE, 0)
;$oIE = _IECreate ("http://www.autoitscript.com")
$oForms = _IEFormGetCollection ($oIE)
ConsoleWrite( "Forms Info There are " & @extended & " forms on this page" & @CRLF)
For $oForm In $oForms
    ConsoleWrite( "Form Info " & $oForm.name  & @CRLF)
Next
ConsoleWrite("End loop of IE Forms" & @CRLF)
$oForm = _IEFormGetCollection ($oIE, 0)

;input user name
$oQuery = _IEFormElementGetObjByName ($oForm, "txtUser")
_IEFormElementSetValue ($oQuery, "zh")
;password
$oQuery = _IEFormElementGetObjByName ($oForm, "txtPass")
_IEFormElementSetValue ($oQuery, "1")
;click image button
;$oQuery = _IEFormElementGetObjByName ($oForm, "ImageButton1")
_IEFormImageClick ($oForm, "ImageButton1", "name")
;$oIE = _IE_Example ("frameset")
local $oFrames = _IEFrameGetCollection($oIE)
local $iNumFrames = @extended
local $i
local $oFrame
local $oFrameLeft
Local $strFrameUrl
ConsoleWrite("Frame number = " & $iNumFrames & @CRLF)
For $i = 0 to ($iNumFrames - 1)
    $oFrame = _IEFrameGetCollection ($oIE, $i)
    ConsoleWrite("Frame Info = " & _IEPropertyGet ($oFrame, "locationurl") & @CRLF)
$strFrameUrl = _IEPropertyGet ($oFrame, "locationurl")

if StringRight($strFrameUrl, 10) = "/left.aspx" Then
  $oFrameLeft = $oFrame ; get correct url
endif

Next
_IELinkClickByText ($oFrameLeft, "业务办理")
;click the link in left frame
sleep(3000)

$oFrames = _IEFrameGetCollection($oIE)
$iNumFrames = @extended
local $oFrameShouJian
local $TempStrUrl = "/newwork.aspx?StartType=ShouJian"
For $i = 0 to ($iNumFrames - 1)
    $oFrame = _IEFrameGetCollection ($oIE, $i)
    ConsoleWrite("Frame Info = " & _IEPropertyGet ($oFrame, "locationurl") & @CRLF)
$strFrameUrl = _IEPropertyGet ($oFrame, "locationurl")

ConsoleWrite("get frame URL: " & $strFrameUrl & @CRLF)
;if StringRight($strFrameUrl, 12) = "/conLeft.htm" Then

if StringRight($strFrameUrl, stringlen($TempStrUrl)) = $TempStrUrl Then
  ConsoleWrite("hit correct URL" & @CRLF)
  $oFrameShouJian = $oFrame ; assign correct url
endif

Next
ConsoleWrite("get span id" & @CRLF)
local $oSpan = _IEGetObjById ($oFrameShouJian, "Datagrid1__ctl2_TreeView1t0")
ConsoleWrite("have got span id = " & $oSpan.id & @CRLF)
;$oSpan.fireEvent("onclick")
local $oChildDiv = $oSpan.firstChild
Local $oChildSpan = $oChildDiv.firstChild
$oChildSpan.fireEvent("onclick")
local $Error
local $InputApplyName = ""
Do
$InputApplyName = InputBox("name ","applier name")
Until not ($InputApplyName  ="")
;================================================== Get the frame of content ==================================
; The source content of the frame is as follwing
$oFrames = _IEFrameGetCollection($oIE)
$iNumFrames = @extended
local  $oFrameShouLi
$TempStrUrl = "&ChineseWord=&EnterpriseName=&fieldPath="
              ;http://10.68.108.16/LangChao.ECGAP.InPortal/Business/ShowTodoWork.aspx?ActivitySchemeGuid=791a0ed2-57b2-4d05-aac6-1f12d74dff36&ActivityModelStepId=3&FormID=CXQCZJ_TongYongBiaoDan&ActivityModelGuid=ab033083-3b3f-4e63-8d71-10fd27d3ca83&AppType=WkFlow&Wf=first&type=new&SerailNO=36015&acttype=&acttypefrom=&SequenceNum=inspur0000035419&ChineseWord=&EnterpriseName=&fieldPath=
For $i = 0 to ($iNumFrames - 1)
    $oFrame = _IEFrameGetCollection ($oIE, $i)
    ;ConsoleWrite("Frame Info = " & _IEPropertyGet ($oFrame, "locationurl") & @CRLF)
$strFrameUrl = _IEPropertyGet ($oFrame, "locationurl")

ConsoleWrite("get URL of form to fill in: " & $strFrameUrl & @CRLF)
;if StringRight($strFrameUrl, 12) = "/conLeft.htm" Then

if StringRight($strFrameUrl, stringlen($TempStrUrl)) = $TempStrUrl Then
  ConsoleWrite("hit URL" & @CRLF)
  $oFrameShouLi = $oFrame ;
endif

Next
;============ The above is ok. The problem come up when executing the following code to try accessing some input box in IE frame  ===
;============ The source code of the frame is as attached
;============ The following iteration can't find the correct input box of "ShengQingZhe"
;============ I try to set value of the input box but fail to get access to its reference, not even say assigning value
local $oElement
local $oInputs = _IETagNameAllGetCollection ($oFrameShouLi)
local $TempRecordOfInputStr
For $oElement In $oInputs
$TempRecordOfInputStr = "name = " & $oElement.tagname & "  id = " & $oElement.id & @CRLF
    MsgBox(0, "Form Input Type", $TempRecordOfInputStr)
Next

;The following accessing for ShenQingZhe would bring up error, no find.
local $oShenQingZhe =  _IEGetObjById ($oFrameShouLi,"ShenQingZhe")
;$oShenQingZhe.value = "xxx"
;_IEFormElementSetValue ($oShenQingZhe, $InputApplyName)

local $oLianXiRen = _IEGetObjByName($oFrameShouLi,"LianXiRen")
;_IEFormElementSetValue ($oLianXiRen, $InputApplyName)

Share this post


Link to post
Share on other sites



#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.6.1
Author: JianFei

Script Function:
Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include 

Opt("MustDeclareVars", 1) ;0=no, 1=require pre-declare
Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase

; http://www.kjjxjy.com/WebAcc/?ver=1

Local $urlStart, $oIE
Local $oForms , $oForm;
Local $oQuery;

$urlStart = "http://10.68.108.16/LangChao.ECGAP.InPortal/login/formlogin.aspx"
$oIE = _IECreate ($urlStart)

; windows position
_IEPropertySet($oIE, "left",0)
_IEPropertySet($oIE, "top",0)
_IEPropertySet($oIE, "width", @DesktopWidth)
_IEPropertySet($oIE, "height", @DesktopHeight)

sleep(2000)
;send("{ENTER}")



;$oForm = _IEFormGetCollection ($oIE, 0)
;$oIE = _IECreate ("http://www.autoitscript.com")
$oForms = _IEFormGetCollection ($oIE)
ConsoleWrite( "Forms Info There are " & @extended & " forms on this page" & @CRLF)
For $oForm In $oForms
ConsoleWrite( "Form Info " & $oForm.name & @CRLF)
Next

ConsoleWrite("End loop of IE Forms" & @CRLF)

$oForm = _IEFormGetCollection ($oIE, 0)


;input user name
$oQuery = _IEFormElementGetObjByName ($oForm, "txtUser")
_IEFormElementSetValue ($oQuery, "zh")

;password
$oQuery = _IEFormElementGetObjByName ($oForm, "txtPass")
_IEFormElementSetValue ($oQuery, "1")

;click image button
;$oQuery = _IEFormElementGetObjByName ($oForm, "ImageButton1")
_IEFormImageClick ($oForm, "ImageButton1", "name")

;$oIE = _IE_Example ("frameset")
local $oFrames = _IEFrameGetCollection($oIE)
local $iNumFrames = @extended
local $i
local $oFrame
local $oFrameLeft

Local $strFrameUrl
ConsoleWrite("Frame number = " & $iNumFrames & @CRLF)

For $i = 0 to ($iNumFrames - 1)
$oFrame = _IEFrameGetCollection ($oIE, $i)
ConsoleWrite("Frame Info = " & _IEPropertyGet ($oFrame, "locationurl") & @CRLF)
$strFrameUrl = _IEPropertyGet ($oFrame, "locationurl")

if StringRight($strFrameUrl, 10) = "/left.aspx" Then

$oFrameLeft = $oFrame ; get correct url
endif

Next

_IELinkClickByText ($oFrameLeft, "业务办理")

;click the link in left frame

sleep(3000)


$oFrames = _IEFrameGetCollection($oIE)
$iNumFrames = @extended
local $oFrameShouJian
local $TempStrUrl = "/newwork.aspx?StartType=ShouJian"

For $i = 0 to ($iNumFrames - 1)
$oFrame = _IEFrameGetCollection ($oIE, $i)
ConsoleWrite("Frame Info = " & _IEPropertyGet ($oFrame, "locationurl") & @CRLF)
$strFrameUrl = _IEPropertyGet ($oFrame, "locationurl")

ConsoleWrite("get frame URL: " & $strFrameUrl & @CRLF)
;if StringRight($strFrameUrl, 12) = "/conLeft.htm" Then

if StringRight($strFrameUrl, stringlen($TempStrUrl)) = $TempStrUrl Then
ConsoleWrite("hit correct URL" & @CRLF)
$oFrameShouJian = $oFrame ; assign correct url
endif

Next

ConsoleWrite("get span id" & @CRLF)
local $oSpan = _IEGetObjById ($oFrameShouJian, "Datagrid1__ctl2_TreeView1t0")
ConsoleWrite("have got span id = " & $oSpan.id & @CRLF)

;$oSpan.fireEvent("onclick")
local $oChildDiv = $oSpan.firstChild

Local $oChildSpan = $oChildDiv.firstChild

$oChildSpan.fireEvent("onclick")

local $Error
local $InputApplyName = ""

Do
$InputApplyName = InputBox("name ","applier name")
Until not ($InputApplyName ="")

;================================================== Get the frame of content ==================================
; The source content of the frame is as follwing

$oFrames = _IEFrameGetCollection($oIE)
$iNumFrames = @extended
local $oFrameShouLi
$TempStrUrl = "&ChineseWord=&EnterpriseName=&fieldPath="
;http://10.68.108.16/LangChao.ECGAP.InPortal/Business/ShowTodoWork.aspx?ActivitySchemeGuid=791a0ed2-57b2-4d05-aac6-1f12d74dff36&ActivityModelStepId=3&FormID=CXQCZJ_TongYongBiaoDan&ActivityModelGuid=ab033083-3b3f-4e63-8d71-10fd27d3ca83&AppType=WkFlow&Wf=first&type=new&SerailNO=36015&acttype=&acttypefrom=&SequenceNum=inspur0000035419&ChineseWord=&EnterpriseName=&fieldPath=
For $i = 0 to ($iNumFrames - 1)
$oFrame = _IEFrameGetCollection ($oIE, $i)
;ConsoleWrite("Frame Info = " & _IEPropertyGet ($oFrame, "locationurl") & @CRLF)
$strFrameUrl = _IEPropertyGet ($oFrame, "locationurl")

ConsoleWrite("get URL of form to fill in: " & $strFrameUrl & @CRLF)
;if StringRight($strFrameUrl, 12) = "/conLeft.htm" Then

if StringRight($strFrameUrl, stringlen($TempStrUrl)) = $TempStrUrl Then

ConsoleWrite("hit URL" & @CRLF)
$oFrameShouLi = $oFrame ;
endif

Next

;============ The above is ok. The problem come up when executing the following code to try accessing some input box in IE frame ===
;============ The source code of the frame is as attached
;============ The following iteration can't find the correct input box of "ShengQingZhe"
;============ I try to set value of the input box but fail to get access to its reference, not even say assigning value

local $oElement
local $oInputs = _IETagNameAllGetCollection ($oFrameShouLi)
local $TempRecordOfInputStr
For $oElement In $oInputs
$TempRecordOfInputStr = "name = " & $oElement.tagname & " id = " & $oElement.id & @CRLF
MsgBox(0, "Form Input Type", $TempRecordOfInputStr)
Next



;The following accessing for ShenQingZhe would bring up error, no find.
local $oShenQingZhe = _IEGetObjById ($oFrameShouLi,"ShenQingZhe")
;$oShenQingZhe.value = "xxx"
;_IEFormElementSetValue ($oShenQingZhe, $InputApplyName)


local $oLianXiRen = _IEGetObjByName($oFrameShouLi,"LianXiRen")
;_IEFormElementSetValue ($oLianXiRen, $InputApplyName)
The autoit code I trying to access the IE input box

Share this post


Link to post
Share on other sites

What diagnostic messages are sent to the SciTe console when you run your code? Focus on the first one you receive and work from there.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0