delphi - how to retrieve text from chrome website -


how can retrieve text web sites text boxes in delphi, example suppose type "dragon" in google's search box oppened on chrome, how retrieve text search box?? wm_gettext or getwindowtext works? want know how work on google chrome, found ie:

uses shdocvw, mshtml;  procedure gettextfromeditiexplorer(liststr: tstringlist); var   shellwindow            : ishellwindows;   web_browser            : iwebbrowser2;   reg_shell_window       : idispatch;   dummy                  : ihtmldocument2;   ovelements             : olevariant;   document               : variant;   windowscount           : integer;   elementscount          : integer;   formscount             : integer; begin   shellwindow := coshellwindows.create;  //provides access collection of open shell windows   windowscount := 0 shellwindow.count     //iterate through number of windows in shell windows collection   begin     reg_shell_window := shellwindow.item(windowscount);       //returns registered shell window specified index.     if reg_shell_window = nil continue;    //go next reg window     reg_shell_window.queryinterface(iwebbrowser2, web_browser);   // determines if interface can used object     if web_browser <> nil     begin       web_browser.document.queryinterface(ihtmldocument2, dummy);       if dummy <> nil       begin         web_browser     := shellwindow.item(windowscount) iwebbrowser2;         document        := web_browser;           formscount := 0 document.forms.length - 1           begin             ovelements := document.forms.item(formscount).elements;             elementscount := 0 ovelements.length - 1             begin               try                 if (comparetext(ovelements.item(elementscount).tagname, 'input') = 0)  ,  (comparetext(ovelements.item(elementscount).type, 'text') = 0)                 liststr.add('control name ['+ovelements.item(elementscount).name+']'+' type  -> '+ovelements.item(elementscount).type+'  ->  value  ['+ovelements.item(elementscount).value+']');               except                 liststr.add('error reading element n° '+inttostr(elementscount));               end;             end;           end;       end;     end;   end; end;  procedure tform1.btn1click(sender: tobject); var list : tstringlist; begin    list:=tstringlist.create;    gettextfromeditiexplorer(list);    showmessage(list.text); end; 

txz


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -