What I am trying to do is go to a website using a webbrowser, and then simulate a click. I can do this easy enough when the click is on a regular button, not handling javascript. But it seems that the website has a javascript function handling the click that I want to simulate:
<script language='JavaScript' type='text/javascript'><!-- function setgotopageNR() { if (document.go开发者_运维技巧topageform.gotopage_reverse.value=='1') { document.gotopageform.page.value=8+1-document.gotopageform.gotopage.value; } else { document.gotopageform.page.value=document.gotopageform.gotopage.value; } } //--></script>
I have tried various solutions found through googling, such as WebBrowser1.Document.InvokeScript, also opening the website in internet explorer and then converting its document to IHTMLDocument2 and getting its parent window as IHTMLWindow2 and then using execScript.
Any ideas?
Normally one would do document.getElementById(id).click()
. It should be easy to convert to whatever language you are using to host web browser.
If click
does not work please post more details on solutions you've already tried and what problems you got.
精彩评论