Wayne Barron
asked on
TWebBrowser and Submit.Form issue?
Hello All;
I am using the following code to click the [Submit] button on my site.
VIA the TWebBrowser ( TEmbeddedWB). This works great, except it has a problem?
After it click the [Submit] Button, and the next page opens, I get an
Exception. It is trying to [Submit] the page again.
I have used this code before, and have never had this problem before.
And now ?? I do not know ??
Provided is the Code that I am using.
Below the Code will be the " Exception " that I received on the next page.
==+==+==+==+==+==+==++=+== +==+=++=+= =+==+==
add to [Uses : MSHTML_TLB; ]
procedure TProject1.AdminWebDocument Complete(S ender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
var
AdminSubmit : IHTMLInputElement;
MyDocument : IHTMLDocument3;
begin
MyDocument := AdminWeb.Document as IHTMLDocument3;
if Assigned(MyDocument) then
begin
AdminSubmit := (MyDocument.getElementsByN ame('Admin _Login').i tem(0,'')a s
IHTMLInputElement);
AdminSubmit.Form.Submit;
end; end;
==+==+==+==+==+==+==++=+== +==+=++=+= =+==+==
Exception
-------------------------- -
Debugger Exception Notification
-------------------------- -
Project Project.exe raised exception class EAccessViolation with message
'Access violation at address 00483C79 in module 'Project.exe'. Read of
address 00000000'. Process stopped. Use Step or Run to continue.
-------------------------- -
OK Help
-------------------------- -
It lands on
==+==+==+==+==+==+==
AdminSubmit.Form.Submit;
==+==+==+==+==+==+==
Any idea's on how to make this code work to where it only executes
When the " Username & Password " form is presented?
And not on pages that do not require it?
Thank you all in advance.
Carrzkiss
I am using the following code to click the [Submit] button on my site.
VIA the TWebBrowser ( TEmbeddedWB). This works great, except it has a problem?
After it click the [Submit] Button, and the next page opens, I get an
Exception. It is trying to [Submit] the page again.
I have used this code before, and have never had this problem before.
And now ?? I do not know ??
Provided is the Code that I am using.
Below the Code will be the " Exception " that I received on the next page.
==+==+==+==+==+==+==++=+==
add to [Uses : MSHTML_TLB; ]
procedure TProject1.AdminWebDocument
const pDisp: IDispatch; var URL: OleVariant);
var
AdminSubmit : IHTMLInputElement;
MyDocument : IHTMLDocument3;
begin
MyDocument := AdminWeb.Document as IHTMLDocument3;
if Assigned(MyDocument) then
begin
AdminSubmit := (MyDocument.getElementsByN
IHTMLInputElement);
AdminSubmit.Form.Submit;
end; end;
==+==+==+==+==+==+==++=+==
Exception
--------------------------
Debugger Exception Notification
--------------------------
Project Project.exe raised exception class EAccessViolation with message
'Access violation at address 00483C79 in module 'Project.exe'. Read of
address 00000000'. Process stopped. Use Step or Run to continue.
--------------------------
OK Help
--------------------------
It lands on
==+==+==+==+==+==+==
AdminSubmit.Form.Submit;
==+==+==+==+==+==+==
Any idea's on how to make this code work to where it only executes
When the " Username & Password " form is presented?
And not on pages that do not require it?
Thank you all in advance.
Carrzkiss
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The pleasure was mine :-)
ASKER
Adding the
is assigned(AdminSubmit) then
right before - AdminSubmit.Form.Submit;
Did the trick.
Once again, thank you very much.
Carrzkiss