I got this code from HTML:
<div id="login-buttons">
<div id="js_login_button">
<a href="#" onclick="$('#login_form').submit()" class="login_button">
<span class="button_left"></span>
<span class="button_middle">Login</span>
<span class="button_right"></span>
</a>
</div>
</div>
Now I need a C# code to activate / perform a click into the webpage (which is loaded into a webBrowser )
//webBrowser1.Document.InvokeScript("$('#login_form').submit()");
This doesn't work for me, I tried and searched a lot but I can't find anything. I CANNOT add a function because It's from a website.
Please help me :)
Note: If you need more information from which website I want to make an auto login system. Just ask :)
InvokeScript
executes a function by name, rather than evaluates the code. Define a function by name that does what you want.
<script>
function foo () {
$('#login_form').submit()
};
</script>
In the C# code, call the function by name
webBrowser1.Document.InvokeScript("foo");
There's more information on the documentation which covers how to pass parameters and receive results.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.