Intro: I have a Form, with a TcppWebBrowser on it. I Navigate() to a known URL. I fill the edit boxes on the page with username and password, programmatically. I then simulate a click on a "Validate" button that leads me to another page. On that last page, I do have elements, some of which have an HyperLink. If I do click on the text, it leads to another page. But that is a text element, not a button.

this is an snippet from the .mht page as saved from Internet Explorer:

But that code has no effect. The vForm is the correct element, I can find it with the debugger, as it's "outertext" is correctly the text seen on screen. So the first line above is valid. But the "click" function has no effect.

Now the questions:1- How can I simulate the HyperLink click?2- Where could I find a listing of the valid functions I could use? I mean, OleFunction("click"), but what else?

pidgi2009 wrote:Now, I want to simulate a click on the hypertext link on the page, programmatically. I cannot find how...

That is because you are not going deep enough into the DOM. You are trying to click on a <DIV> element, not on an <A> element. The <DIV> in question has an <A> child element inside of it. That is what you need to click on instead, eg:

Thank you very much for the very detailed help!I will study it in greater depth. Until now, the code doesn't compile... my version of Tokyo tells me that _di_IHTMLElementCollection and the other _di_xxxxx are not recognized.I tried to include <MSHTML.hpp> (instead of, or in addition to, or before or after), to no avail... the errors are different but it still does not compile. But I am interrested in applying the solution you suggest.I will work a bit on it, then I will post my results here. Maybe it could help somebody...Thank you again!

pidgi2009 wrote:Until now, the code doesn't compile... my version of Tokyo tells me that _di_IHTMLElementCollection and the other _di_xxxxx are not recognized.

The actual interfaces themselves are declared in mshtml.h, which is why I added that #include in my example. I forgot that it doesn't declare any smart wrappers for them, though. I have updated my previous example to fix that.

pidgi2009 wrote:I tried to include <MSHTML.hpp> (instead of, or in addition to, or before or after)

That would work too, but defines DelphiInterface wrappers instead of TComInterface wrappers. Either way would work, though.

pidgi2009 wrote:to no avail... the errors are different but it still does not compile.

My bad. I forgot that IHTMLAnchorElement does not derive from IHTMLElement. click() is a method of IHTMLElement, and the anchor element implements both IHTMLElement and IHTMLAnchorElement, so you can query the IHTMLAnchorElement object for its IHTMLElement: