TEmbededWB click a button

I have used the fill form to populate the text box now I need to click the button fo post it. I found FillFormAndExcecute  but not working for me.
250 points because I need to figure out whats going on tonight.


begin
 WB.Navigate('http://www.autocheck.com/?utm_medium=partner&utm_campaign=partner&utm_source=DMV.org&WT.mc_id=2401&siteID=2401&vin=');
  WB.Wait;
  with WB do
  begin
    FillForm('vin', 'KNDJA7231V5547306'); 
  end;

Open in new window

Grant FullenNONEAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Grant FullenNONEAuthor Commented:
I found the code below here but it does not work properly.
procedure TForm1.wbDocumentComplete(ASender: TObject;
  const pDisp: IDispatch; var URL: OleVariant);
var
  AdminSubmit : IHTMLInputElement;
  MyDocument : IHTMLDocument3;
begin
   MyDocument := wb.Document as IHTMLDocument3;
   if Assigned(MyDocument) then
   begin
   AdminSubmit := (MyDocument.getElementsByName('vin').item(0,'')as
IHTMLInputElement);
     if Assigned(AdminSubmit) then  AdminSubmit.Form.Submit;
   AdminSubmit.Form.Submit;
end;

Open in new window

0
smotCommented:

uses
 MSHTML_EWB;
 
procedure TForm1.FormCreate(Sender: TObject);
begin
 WB.Navigate('http://www.autocheck.com/?utm_medium=partner&utm_campaign=partner&utm_source=DMV.org&WT.mc_id=2401&siteID=2401&vin=');
end;
 
function WB_ClickButton(WebBrowser: TEmbeddedWB; FieldName: string;
  FieldType: string='submit'): Boolean;
var
  iDoc1: IHTMLDocument2;
  Index: Integer;
  Disp: IDispatch;
  Inp: IHTMLInputElement;
begin
  WebBrowser.Document.QueryInterface(IHTMLDocument2, iDoc1);
  Result := iDoc1 <> nil;
  if Result then
  begin
    for Index := 0 to IDoc1.all.length - 1 do
    begin
      Disp := IDoc1.all.item(Index, 0);
      if (Supports(Disp, IHTMLInputElement, Inp))
        and (SameText(Inp.type_, FieldType) and SameText(Inp.Value, FieldName)) then
      begin
        (Inp as IHTMLElement).click;
        Result := True;
        Exit;
      end;
    end;
  end;
end;
procedure TForm1.WBDocumentComplete(ASender: TObject;
  const pDisp: IDispatch; var URL: OleVariant);
begin
  WB.FillForm('vin', 'KNDJA7231V5547306');
  WB_ClickButton(WB, 'Go');
end;

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Grant FullenNONEAuthor Commented:
WOW thanks for writing the function :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.