Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Problem posting form with hidden style sheet button

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
julieo
How do I cheat?
Reputation: 0

Joined: 03 Jan 2010
Posts: 1

PostPosted: Sun Jan 03, 2010 3:12 pm    Post subject: Problem posting form with hidden style sheet button Reply with quote

I have a Delphi 5 application that downloads the html from a web page, autofills the input fields, and submits the login. It has been revised numerous times as the web page source code changed and has always worked. This time the web page has changed to using style sheets. I can autofill the input fields but when it comes to the button I am now having problems. It isn't a web page I can change...I just use my code to automate the login.

There is also a secondary problem that has me totally baffled. Before I began the changes I recompiled the working program and got an EOleError with message 'Method Name' not supported by automation object. I had to change the code to use 'ID' instead of 'Name' and that part works. Same thing with 'Type'. I don't understand why the working program suddenly doesn't compile anymore. It's the same Delphi 5 I have been using for ages.

Here is the code but I had to change the actual website name to protect my account with them. I removed code that wasn't necessary for this problem.

Code:

unit MainFrm;
interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  IniFiles, StdCtrls, OleCtrls, SHDocVw, ExtCtrls, MSHTML, SNDKEY32;
type
   string255 = string[255];
  TForm1 = class(TForm)
    WebBrowser1: TWebBrowser;
    Panel1: TPanel;
    btnSubmit: TButton;
    Button1: TButton;
    Login: TButton;
    Timer1: TTimer;
    Button6: TButton;
    procedure btnSubmitClick(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure LoginClick(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure WebBrowser1NavigateComplete2(Sender: TObject;
      const pDisp: IDispatch; var URL: OleVariant);
    procedure Button6Click(Sender: TObject);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
      ADataSet, Adataset2 : string255;
  end;

var
  Form1: TForm1;
  madeit : boolean;
  iDisp: IDispatch;
  iColl: IHTMLElementCollection;
  InputImage: HTMLInputImage;
  ov: OleVariant;
  whichpage : integer;
  inifile : tinifile;
  dataset, dataset2, CSVFile, CSVcopy, Passwd : string255;

implementation

uses HTTPApp;

{$R *.DFM}

procedure TForm1.LoginClick(Sender: TObject);
var
  EncodedDataString, Str, altname: string;
  PostData: OleVariant;
  FormItem: Variant;
  Headers: OleVariant;
  ov : OleVariant;
  idisp : idispatch;
  I: Integer;
  ii,jj: Word;

  Document: Variant;
  Document2: IHtmlDocument2;

  ovElements: OleVariant;
  j, k, m, l: Integer;

begin

   While WebBrowser1.ReadyState<>READYSTATE_COMPLETE do Application.ProcessMessages;

   if WebBrowser1.OleObject.Document.all.tags('FORM').Length = 0 then
   begin
     Exit;
   end;        //count forms on document
   for I := 0 to WebBrowser1.OleObject.Document.forms.Length - 1 do
   begin
    FormItem := WebBrowser1.OleObject.Document.forms.Item(I);
    k := FormItem.Length - 1;     // 08/05/05
    for j := 0 to FormItem.Length - 1 do
    begin
        if FormItem.Item(j).id = 'loginEmail' then
        begin
          FormItem.Item(j).Value := 'myemail';
        end;
        if FormItem.Item(j).id = 'loginPassword' then
        begin
          FormItem.Item(j).Value := trim(Passwd); // from an ini file
        end;
        if FormItem.Item(j).id = 'rememberMe' then
        begin
          FormItem.Item(j).Value := '0';
        end;
        // when Submit button is found, try to click
        if FormItem.Item(j).Name = 'Submit' then
        begin
            madeit := true;
             FormItem.Item(j).Click;  // add this back in when button chgd from image button to hidden input field
        end;
       end;
     end;
{ commented this next code out when no longer image button on form
     WebBrowser1.ControlInterface.Document.QueryInterface(IHtmlDocument2, Document2);
     if not Assigned(Document2) then
     begin
        Exit;
     end;
     ov := 'INPUT';
     iDisp := Document2.all.tags(ov);
     if Assigned(IDisp) then
     begin
        IDisp.QueryInterface(IHTMLElementCollection, iColl);
        if Assigned(iColl) then
        begin
            for i := 1 to iColl.Get_length do
            begin
                iDisp := iColl.item(pred(i), 0);
                iDisp.QueryInterface(HTMLInputImage, InputImage);
                if Assigned(InputImage) then
                begin
                altname := InputImage.alt;
                    if (InputImage.alt = 'Secure Login') or (InputImage.alt = 'signIn') then
                 // if the name is submit / falls der name submit lautet
                    begin
                        InputImage.Click;  // click it / klick es
                    end;
                end;
            end;
        end;
     end;
}



Here is the web page code -
[code]
<DIV class=p-inside-wrapper>
<FORM id=signinForm name=signinForm action=signin.signinform method=post
type="form">
<DIV class=t-invisible><INPUT type=hidden
value=H4sIAAAAAAAAAJWRvUoDQRRGrwGbBJuALyAJdhML02iVQqsogcVa7s7ejCPz570TNzY+ik8gvkQKO9/BB7C1SqFZTBvW9sDhfPC9fsF+PYCjwppgw5mLxgYdfYqBQr49UQ0gj9YJwziyUZhQ35HKmEgyP42VjkzOlqpEITUpfyHqfGnJVYOC8iINb1a9z8P3dQf2ptDTMWSO7ho9ZehP7/ERRw6DGRWZbTDny5Sh21QvNtXW2yb/3TbjqEmkWJTeitgYVm/V6fz75aMDsEz1MQx3dhOK1JEreYBngAwHDZ390db6xt55AJMnXxJ72pa6W3RF7cSm8QPEho0q6QEAAA==
name=t:formdata></DIV>
<DIV class="erromsrsg offscreenOnLoad hidden" id=fieldErromsrsg>Please provide
the correct information in the highlighted fields. </DIV>
<DIV>
<FIELDSET><LEGEND>Login Page</LEGEND>
<DIV class="input clear"><LABEL for=loginEmail>Email</LABEL><INPUT id=loginEmail
name=loginEmail></DIV>
<DIV class=input><LABEL for=loginPassword>Password</LABEL><INPUT
id=loginPassword type=password name=loginPassword><BR><SPAN class=optional>6-20
characters (case sensitive)</SPAN></DIV><!-- Only show Autologin stuff for STH login flow -->
<DIV class=input><INPUT class="inline box" id=rememberMe type=checkbox
name=rememberMe><LABEL class="inline xsmall" for=rememberMe>Remember me on this
computer</LABEL></DIV>
<DIV class="input clear"><BUTTON class="btn-signin orange" name=signIn
type=submit value="signIn"><SPAN>Sign In</SPAN></BUTTON></DIV>
<DIV class=clear><A class=linkSmall
href="mywebpage/login/ForgotPassword/?goto=P%2F%2FuwwcLCiCnArf24nS2ZxJV%2Brqgr9kn0WKqNZG3n%2Bw%3D&amp;flow=0">Forget
your password? </A></DIV></FIELDSET></DIV></FORM></DIV></DIV></DIV>
[/code
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites