Delphi WebBrowser Regular Usage Demo sample

Source: Internet
Author: User
Tags vars

var   Form   :     ihtmlformelement     ;        D:ihtmldocument2     ; begin    with   WebBrowser1   do   begin          D   : =   Document   as   IHTMLDocument2;          Form   : =   d.forms.item (' Form1 ', 0)   as   ihtmlformelement;   Form1 the table sole name          //title as the text box in the form        (Form.item (' title ', 0)   as   IHTMLElement). SetAttribute (' value ', S_ title,0);          (Form.item (' content ', 0)   as   IHTMLElement). SetAttribute (' value ', edit1.text,0);        (Form.item (' Add ', 0)   as IHTMLElement). Click;//add is the button name    end;

Get and set input form values in Delphi's WebBrowser

var    i:integer;    Myole:olevariant;begin    myole: = wb1. Document;    For I: = 0 to Myole.all.length-1 does    begin        if Myole.all.item (i). TagName = ' INPUT ' then        begin            Mmo1. Lines.add (Myole.all.item (i). name);            Mmo1. Lines.add (Myole.all.item (i). value);        End;    End;end;

Webbrowser1.gohome; To the browser default home page Webbrowser1.refresh; Refresh Webbrowser1.goback; Back Webbrowser1.goforward; Forward WebBrowser1.Navigate (' ... '); Opens the specified page webbrowser1.navigate (' About:blank '); Open empty page--------------------------------------------------------------------------------//Open empty page and write to ... WebBrowser1.Navigate (' about:


Log in on your own initiative

Input Varo:olevariant;begino for single frames: = WebBrowser.OleObject.document.all.item (' Loginuserid ', 0); Locate the login username input box O.value: = ' TEST '; O: = WebBrowser.oleobject.document.all.item (' Loginpassword ', 0);           Locate the input box for login password O.value: = ' TEST ' WebBrowser.oleobject.document.Forms.Item (0, 0). Submit;           First form submission {o: =webbrowser.oleobject.document.all.item (' Login ', 0); Or submit an O with the specified form name.   Click; Click Action, other objects can also be the same operation}end, multiple frames input, FrameIndex for the frame ordinal varo:olevariant;begin//find the login username input box o: = WebBrowser.oleobject.document.documentelement.document.frames.item (FrameIndex). Document.All.Item (' Loginuserid ' , 0); O.value: = ' TEST ';//Find the input box for login password o: = WebBrowser.oleobject.document.documentelement.document.frames.item ( Framindex). Document.All.Item (' Loginpassword ', 0); O.value: = ' TEST '// The first form submits a WebBrowser.oleobject.document.documentelement.document.frames.item (Framindex). Document. Forms.item (0, 0). Submit; {//or submit with the specified form name o: =webbrowser.oleobject.document.documentelement.document.frames.item (Framindex).. Document.All.Item (' Login ', 0); O.    Click;  Click on the operation, other objects can also be the same operation}end;



Delphi WebBrowser Regular Usage Demo sample

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.