Jump to content

TUniURLFrame Help me


j.neto233

Recommended Posts

I need automatically fill in web forms, fill in the fields, perform the functions of the buttons, 
 
logging in automatically on a page.
 
must also read the result of a form.
 
In Delphi i use the TWebBrowser that does the job perfectly.
 
I'm having trouble using the TUniURLFrame. someone help me, or know if it is possible to do this with TUniURLFrame?
 
 
In Delphi with TWebBrowser works well:
 
sample:
 
PROCEDURE TForm1.Button1Click(Sender: TObject);
VAR
  Doc3: IHTMLDocument3;
BEGIN
 
  WebBrowser1.Navigate('https://pt-br.facebook.com/');
 
  Doc3 := Webbrowser1.Document AS IHTMLDocument3;
  Doc3.getElementById('email').setAttribute('value', 'neto@hotmail.com', 0);
  Doc3.getElementById('pass').setAttribute('value', 'pAsswOrd', 0);
  WebBrowser1.OleObject.Document.all.Item('loginbutton', 0).click;
  WebBrowser1.Silent;
 
END;
 
 
Anyone have any idea how to do this UniGUI?

 

  • Upvote 1
Link to comment
Share on other sites

  • 4 months later...
  • 3 weeks later...
  • 2 weeks later...
  • 2 weeks later...

I needed a phone number lookup function, so I used an Indy http client component to 
GET the html file from the phone lookup site, and then made a very simple parsing
procedure to extract the phone/user info.
 
I guess you could do the same, even extract all links and get them too, like css
and images etc. I dont see the reason to use urlframe to get only the html file itself, as
you then also have the visual presentation taking up resources. Compared to this,
the resource use by only downloading may be much smaller, esp. if media is involved.

uses
  IdHTTP;

...

function getUrl(aURL: string): string;
const
  cUSER_AGENT = 'Mozilla/4.0 (MSIE 6.0; Windows NT 5.1)';
var
  IdHTTP: TIdHTTP;
  Stream: TStringStream;
begin
  Result := '';
  IdHTTP := TIdHTTP.Create(nil);
  Stream := TStringStream.Create;
  try
    IdHTTP.Request.UserAgent := cUSER_AGENT;
    try
      IdHTTP.Get(aURL, Stream);
      Result := Stream.DataString;
    except
      Result := '';
    end;
  finally
    Stream.Free;
    IdHTTP.Free;
  end;
end;

URLFrame.zip

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...