c# - How might I call a JavaScript Function in a Page Viewed by a WebBrowser Control from the Application Hosting the WebBrowser Control? -


I have created a C # desktop application that depends on the web crawler idea.

I applied my application to open a website using web browser control and log in to the program and redirect to a specific page, which has Gridview with all the user's data that I want to collect ...

But the problem here is that I know its name by the javascript function removed in Username in Gridview, but it's a desktop app How to call in Ikeshn.

What are namespaces or DLLs that can allow me to do this?

I think this should help you with:

Edit: Depending on that link, here's a small sample application, add a button and webbrowser control to a Windows project and add this code:

 < Code> Public Partial Forms Form 1: Form {Public Form 1 () {Initialization (); this. Web browser 1. Document text = @ " gt; body & gt; & lt; script type =" text / javascript "" & gt; Function show message (text) {warning (text);}  & Lt; / Body & gt; & Lt; Input type = "" button "" onclick = "" ShowMessage (from 'javascript') "" value = "" click me "/> gt; "; } Private Zero Button 1_Click (Object Sender, EventArgs e) {this.webBrowser1.Document.InvokeScript ("ShowMessage", New Object [] {"C #"}}; }}  

If you click the button in the browser, it will show a Javascript message, if you click the button in the form of a window, it will show the C # message.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -