Hello,
you can try this:
on a frameless page, if the form name is "form1" and the submit button name is "sendTo":
String sScript = "document.form1.sendTo.sub
boo
and in a page that contains frames, if the frame index is 2:
String sScript = sScript = "document.frames[2].form1.
boo
(the TCppWebBrowser name in this sample code is "IE")
bool __fastcall ThttpnetWnd::bExecJS(Strin
{
bool bRet = false;
IHTMLDocument2 *doc = NULL;
IHTMLWindow2 *win = NULL;
if( SUCCEEDED(IE->Document->Quer
HRESULT hr = doc->get_parentWindow(&win)
if (SUCCEEDED(hr)) {
Application->ProcessMessage
VARIANT v;
long iExecScript = 0;
VariantInit(&v);
iExecScript = win->execScript( WideString(sScript), WideString("Javascript"), &v );
if( iExecScript == 0 )
bRet = true;
VariantClear ( &v );
win->Release();
Application->ProcessMessage
}
doc->Release();
}
return bRet;
}
Main Topics
Browse All Topics





by: DanRollinsPosted on 2009-10-30 at 15:48:23ID: 25707259
In this specific page, I think that you could just execute the submit action of the form (you are currently executing the OnClick handler of the submit button).
Another possible angle of attack: Set the OnClick action to NULL or "" or "return true;" -- something like that -- and then do the click() on the button... which should then do the default action of submitting the form.
As to a general-purpose way to dismiss a confirm()-function created dialog, I don't know the answer to that. It might be possible.
One other note: Although you are working with Borland C++, you might find some useful general help about browser automation here:
Browser Bot -- Automate Browsing Sequences With C++ e.com/arti cles/Progr amming/Sys tem/Window s__Program ming/Brows er-Bot-Aut omate-Brow sing-Seque nces-With- C-PART-ONE .html
http://www.experts-exchang