Прошу помощи бьюсь уже долго попробовал через iframe , но ни как не удается нажать кнопку с именем "inputFileComponent" в документе. Просто не могу разобраться как до нее добраться по структуре страницы.... В документе есть еще один документ....
Код AutoIt очень скудный у меня, пытался всячески поиследовать дерево документа, но ничего толкового не вышло.
Если кто подскажет хоть в какую сторону двигаться буду премного благодарен!
Код:
<div class="block block-tint" id="block-docs">
<h3 class="header-block small"><span>Документы</span></h3><?xml version="1.0" encoding="UTF-8"?>
<!--
Document : ApplicationAddTab_1
Created on : 11.01.2010
Author : css
-->ххх<div id="formMain:attListUploadBoxID" style="display:none" title="Загрузка файла"><span id="formMain:attListUploadBoxContent">
<div class="form-item">
<label>Тип документа</label>
</div>
<div class="form-item">
<label>Выбрать документ</label>
<small class="gray"><em>допустимые типы файлов: doc</em></small><div><iframe src="fileUploadXhtml.xhtml" id="formMain:j_idt122:uploadFrame" name="formMain:j_idt122:uploadFrame" width="400px" height="60px" title="Input File Frame" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="true"></iframe><input type="hidden" name="formMain:digest64Doc" id="formMain:digest64Doc" value="" /><input type="hidden" name="formMain:localFileNameDoc" id="formMain:localFileNameDoc" value="" /></div><script type="text/javascript" id="formMain:j_idt122">
var iter = 0;
var fillContent = function () {var framej_idt122 = document.getElementById('formMain:j_idt122:uploadFrame').contentWindow;
if (framej_idt122!=null && framej_idt122.document!=null && framej_idt122.document.body!=null && framej_idt122.document.body.innerHTML!=null){
framej_idt122.document.body.innerHTML='<form method="post" action="uploadHtml" enctype="multipart/form-data" id="fileUploadForm" accept-charset="UTF-8"><input type="file" style="color: transparent !important;" name="inputFileComponent" onchange="renderImg(); submitForm();" /><div><img id="loadingId" style="visibility:hidden;" src="resources/images/loading.gif"/></div><input type="hidden" name="loadingImg" value=""/><input type="hidden" name="allowTypes" value="doc,docx,gif,jpg,jpeg,pdf,xls,xlsx"/><input type="hidden" name="clientId" value="formMain:j_idt122"/><input type="hidden" name="digest" value="" id="digest"/><input type="hidden" name="localFileName" value="" id="localFileName"/><input type="hidden" name="notAllowedTypeMessage" value="" id="notAllowedTypeMessage"/><input type="hidden" name="sizeLimitMessage" value="" id="sizeLimitMessage"/><input type="hidden" name="baltinfo.view" value="/account-applicationadd.xhtml"/></form>';
var frameFormj_idt122;
var register = function() {
if (framej_idt122!=null && framej_idt122.document!=null){frameFormj_idt122= framej_idt122.document.getElementsByTagName('form')[0];
var submit = function() {
if(arguments.length == 1 && arguments[0] == 1) { setTimeout(function (){ try{document.getElementById('formMain:digest64Doc').value=framej_idt122.document.getElementById('digest').value;document.getElementById('formMain:localFileNameDoc').value=framej_idt122.document.getElementById('localFileName').value;}catch(e){} },200);}; };
if (frameFormj_idt122) frameFormj_idt122.onsubmit = submit;
var uploadEnd = function() { submit(1); setTimeout(register, 200); };
if (framej_idt122.attachEvent) { framej_idt122.attachEvent('onunload', uploadEnd); } else { framej_idt122.onunload = uploadEnd; }
}};
register();}
else{if(iter<50){setTimeout(fillContent,50); iter++; return;}}}; </script>
</div>
<div class="form-item">
<label>Подписать</label><button id="formMain:loadECPButtonDoc" name="formMain:loadECPButtonDoc" class="refreshIconButton" onclick="fillSertificateList('signaturesDoc');" style="" title="Загрузить" type="button">ui-button</button><script type="text/javascript">widget_formMain_loadECPButtonDoc = new PrimeFaces.widget.CommandButton('formMain:loadECPButtonDoc', {text:false,icons:{primary:'refreshIcon'}});</script>
<select class="form-textfield" style="width: 400px;" id="signaturesDoc" name="signaturesDoc">
<option selected="false" hidden="true" value="21d6476bb70e27ca993270e5f5429f4da806006e"></option>
<option selected="true" value="withoutECP">Без подписи!</option>
</select>
</div><input id="formMain:dataDoc" type="hidden" name="formMain:dataDoc" /><input id="formMain:orderDataDoc" type="hidden" name="formMain:orderDataDoc" /><input id="formMain:signatureDoc" type="hidden" name="formMain:signatureDoc" />
<div style="text-align: center;"><a id="formMain:LoadAndConfirmButtonDoc" href="javascript:void(0);" class="form-submit btn" onclick="clearData(); signDocument(formMain,'signaturesDoc',this,'LoadAndConfirmButtonDoc');;PrimeFaces.ajax.AjaxRequest('/e-auction/account-applicationadd.xhtml',{formId:'formMain',async:false,global:true,source:'formMain:LoadAndConfirmButtonDoc',process:'formMain:attListUploadBoxContent',update:'formMain:attList',oncomplete:function(xhr, status, args){attListUploadBox.hide();;}});" title="Загрузить">Загрузить</a>
<a id="formMain:j_idt127" href="javascript:void(0);" class="form-submit btn" onclick="PrimeFaces.ajax.AjaxRequest('/e-auction/account-applicationadd.xhtml',{formId:'formMain',async:false,global:true,source:'formMain:j_idt127',process:'@all',oncomplete:function(xhr, status, args){attListUploadBox.hide();;}});" title="Отменить">Отменить</a>
</div></span></div><script type="text/javascript">jQuery(function() {attListUploadBox = new PrimeFaces.widget.Dialog('formMain:attListUploadBoxID',{autoOpen:false,minHeight:0,width:750,modal: true,resizable:false,closable:false});});</script><span id="formMain:attListPanel"><table id="formMain:attList" class="files">
<tbody>
<tr>
<td><a href="#" style="color:#1D91C7; font-weight:bold;" onclick="mojarra.jsfcljs(document.getElementById('formMain'),{'formMain:attList:0:j_idt130':'formMain:attList:0:j_idt130'},'');return false"><span id="formMain:attList:0:typeDocName">Копия документов</span></a></td>
<td><a id="formMain:attList:0:j_idt137" href="javascript:void(0);" onclick="PrimeFaces.ajax.AjaxRequest('/e-auction/account-applicationadd.xhtml',{formId:'formMain',async:false,global:true,source:'formMain:attList:0:j_idt137',process:'@all',oncomplete:function(xhr, status, args){showMsgBox(xhr, status, args);;}});">Удалить</a></td>
<td><a id="formMain:attList:0:j_idt143" href="javascript:void(0);" class="js" onclick="PrimeFaces.ajax.AjaxRequest('/e-auction/account-applicationadd.xhtml',{formId:'formMain',async:false,global:true,source:'formMain:attList:0:j_idt143',process:'@all',update:'formMain:attListPanel'});">
ЭП
</a></td>
</tr>
Код:
Local $oF = _IEGetObjById ($oIE, "formMain:attListUploadBoxContent")
ConsoleWrite("oF = "&IsObj($oF)&@CRLF)
ConsoleWrite("@extended = "&@extended&@CRLF);
ConsoleWrite("@error = "&@error&@CRLF);
ConsoleWrite("$fileUp = "&IsObj($oF)&@CRLF)
$iF = _IETagNameGetCollection($oF, "iframe",0)
ConsoleWrite("iF = "&IsObj($iF)&@CRLF)
ConsoleWrite("@extended = "&@extended&@CRLF);
ConsoleWrite("@error = "&@error&@CRLF);
Return
Local $fileUp_ = _IEFormGetObjById ($iF, "fileUploadForm")
ConsoleWrite("@extended = "&@extended&@CRLF);
ConsoleWrite("@error = "&@error&@CRLF);
ConsoleWrite("$fileUp = "&IsObj($fileUp)&@CRLF)
Local $fileUp =_IEFormGetCollection($iF,0)
ConsoleWrite("@extended = "&@extended&@CRLF);
ConsoleWrite("@error = "&@error&@CRLF);
ConsoleWrite("$fileUp = "&IsObj($fileUp)&@CRLF)
;Return
Local $fileUp2 =_IEFormElementGetCollection ($fileUp)
ConsoleWrite("@extended = "&@extended&@CRLF);
ConsoleWrite("@error = "&@error&@CRLF);
ConsoleWrite("$fileUp2 = "&IsObj($fileUp2)&@CRLF)
For $o_Tag In $fileUp2
ConsoleWrite($o_Tag.type&@CRLF);
; If $o_Tag.type == "file" Then
ConsoleWrite($o_Tag.innertext&@CRLF);
; ConsoleWrite($s_Innertext&@CRLF);
_IEAction($o_Tag, 'click')
_IELoadWait($oIE)
; ExitLoop
; EndIf
Next
; ConsoleWrite("$fileUp.tagnmae = "&$fileUp&@CRLF)
; _IEFormSubmit ($fileUp)
$oB = _IEFormElementGetObjByName ($fileUp, "inputFileComponent")
; ConsoleWrite("oB = "&IsObj($oB)&@CRLF)
If IsObj($oB) Then
_IEAction($oB, "click")
EndIf
;Return;
$o_Tags = _IETagNameGetCollection($fileUp, "input")
ConsoleWrite("@extended = "&@extended&@CRLF);
ConsoleWrite("@error = "&@error&@CRLF);
; If @error Then Return SetError(3)
If @error==0 Then
For $o_Tag In $o_Tags
ConsoleWrite($o_Tag.type&@CRLF);
; If $o_Tag.type == "file" Then
ConsoleWrite($o_Tag.innertext&@CRLF);
; ConsoleWrite($s_Innertext&@CRLF);
_IEAction($o_Tag, 'click')
_IELoadWait($oIE)
; ExitLoop
; EndIf
Next
EndIf
Если кто подскажет хоть в какую сторону двигаться буду премного благодарен!