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:
- Code: Select all
<BUTTON =
name=3D"BtnConxn" class=3D"btn suggere clsAlignAnnule" id=3D"BtnConxn" onclick=3D'javascript:WebForm_DoPostBackWithOptions(new
WebForm_PostBackOptions("BtnConxn", "", true, "", "", false, false))'
type=3D"submit" data-ctlracine=3D"true" value=3D"Connexion">Connexion</BUTTON>
Here is my code to simulate the click on the BtnConxn button defined above:
- Code: Select all
Variant vForms = vDocument.OlePropertyGet("All");
Variant vForm = vForms.OleFunction("NamedItem", WideString("BtnConxn").c_bstr());
if (vForm.VUnknown == NULL)
{
ShowMessage("Problème avec l'authentification. (3)");
WebBrowser->OnDocumentComplete = NULL;
return;
}
vForm.OleFunction("click");
Now, I want to simulate a click on the hypertext link on the page, programmatically. I cannot find how...
Here is the definition of the link on the Web page:
- Code: Select all
<DIV class=3D"lien_gros aligne_droite" id=3D"lien_accueil"><A href=3D"https://wwwsom_kind_of_a_secure_site.aspx">Accueil</A></DIV>
I tried with the
- Code: Select all
vForm = vForms.OleFunction("NamedItem", WideString("lien_accueil").c_bstr());
vForm.OleFunction("click");
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?
Thank you for your help!