Question

<tr>
  <td colspan="2" style="text-align: center;">
    <a href="javascript:start_form_submit('SUBMIT');">
      <imgsrc="graphics/proceed_confirm.gif" width="251" height="27" alt="Proceed to Confirmation" border="0">
    </a>
  </td>
</tr>

How to click in this button using delphi?

Was it helpful?

Solution

That is not a button, in the strictest sense of the word. It is just an image inside of a clickable hyperlink.

In any case, neither HTML element has and name or id specified, so you have your work cut out for you. You have to start by querying the WebBrowser.Document for the IHTMLDocument2 interface and then dig through the browser's DOM interfaces as needed looking for the <a> element you are interested in, then you can call its click() method.

OTHER TIPS

thanks bro, im using

function

procedure ExecuteScript(doc: IHTMLDocument2; script: string; language: string);
begin
  if doc <> nil then
  begin
    if doc.parentWindow <> nil then
      doc.parentWindow.ExecScript(script, Olevariant(language)) ;
  end;
end;

and using on button1

script := 'javascript:start_form_submit("SUBMIT");';
ExecuteScript(webbrowser1.Document as IHTMLDocument2, script, 'javascript');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top