Jump to content

TUniURLFrame Help me


j.neto233
 Share

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...

How to obtain the html code of a page open in UniURLFrame1.URL.

example:
// Loading the site
UniURLFrame1.URL:='http://www.nfe.fazenda.gov.br/portal/consulta.aspx?tipoConsulta=completa&tipoConteudo=XbSeqxE8pl8='

// Getting html code site after being loaded
UniMemo1.text: = UniURLFrame1.html.text;

My problem is getting the code, someone can help me with this?

  • Upvote 1
Link to comment
Share on other sites

  • 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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...