MagistrAnatol
![](http://forum.ru-board.com/board/avatars/p149.gif)
Silver Member | Редактировать | Профиль | Сообщение | ICQ | Цитировать | Сообщить модератору Подсобите с такой проблемой - пытаюсь нажать на кнопку через TWebBrowser в C++Builder XE2 вот код странички Код: <INPUT value="Войти" class="inp2" type="button" onclick="on_submit()" > ................. <SCRIPT>function on_submit(){if (document.getElementById("client").value == "") {alert("Введите логин для входа в систему!");return false;}if (document.getElementById("password").value == "") {alert("Введите пароль для входа в систему!");return false;}login.submit();_gat._getTracker('UA-29905618-1')._trackEvent('Общие','Вход','');_gat._getTracker('UA-30154094-1')._trackEvent('Общие','Вход','');}document.getElementById("ViewerN").value=window.navigator.userAgent.substring(window.navigator.userAgent.indexOf("MSIE"),window.navigator.userAgent.indexOf(";", window.navigator.userAgent.indexOf("MSIE")));var loc=""+location;document.getElementById("port").value=loc.substring(loc.lastIndexOf(":")+1, loc.indexOf("/", loc.lastIndexOf(":")));document.getElementById("ClOffset").value = - (new Date()).getTimezoneOffset();function keyevent(e) // submit key{if (e.keyCode == 13) // 13 = enter key{on_submit();}} </SCRIPT> | мой код Код: TComInterface<IHTMLDocument2> pDoc; TComInterface<IHTMLElementCollection> pColl; TComInterface<IDispatch> pTmpDisp; TComInterface<IHTMLInputElement> pElement; TComInterface<IHTMLElement> pButtomElement; TComInterface<IDispatch> pDisp; AnsiString InmemberName = "client"; WideString InmemberData = AdvEditBtn2->Text; AnsiString Inpassword = "password"; WideString InpasswordData = AdvEditBtn3->Text; AnsiString InpCode = "code"; WideString InpCodeData = AdvEditBtn4->Text; AnsiString SubmitButton = "inp2"; if ( SUCCEEDED (browser->Document->QueryInterface(IID_IHTMLDocument2, (LPVOID*)&pDoc))) { if ( SUCCEEDED (pDoc->get_all(&pColl))) { ... if ( SUCCEEDED (pColl->item(TVariant(WideString(SubmitButton)), TVariant(0), &pDisp))) { pButtomElement = pDisp; ShowMessage(1); pButtomElement->click(); } | данные в форму заносятся верно и если нажать кнопочку ручками все нормально, но если давлю программно - получаю Assertion failed: intf!=0, file=c:\...\utilcls.h line 2374 пробовал и AnsiString SubmitButton = "submit"; таже байда. Как правильно нажать на такую кнопку?, у нее получается нет имени???? Ну и походу вопрос - как прочитать каптчу - 4 цыфирки? |