I want to call onclick in C#. I put a WebBrowser to C# based program and in website, there is a button tied with a js function
type="button"
onclick="submitEdgeStory();"
value="Invia la news" class="submit"
I want to call onclick method. I tried to call submitEdgeStory with:
webBrowser1.Document.InvokeScript("submitEdgeStory()");
or
webBrowser1.Document.Forms[1]
.SetAttribute("onclick", "return submitEdgeStory()");
but no way.. I dont know how can I call this function…
PS: I am not using ASP.NET. It’s just a desktop application
And also this is js function
var gPageIsOkToExit = false;
function submitEdgeStory()
{
// Set a variable so that our "before unload" exit handler knows not to verify
// the page exit operation.
gPageIsOkToExit = true;
// Do the submission.
// var frm = document.getElementById("thisform");
frms = document.getElementsByName("ATISUBMIT");
if (frms)
{
if (frms[0])
frms[0].submit();
}
}
window.onbeforeunload = function (event)
{
// See if this is a safe exit.
if (gPageIsOkToExit)
return;
if (!event && window.event)
event = window.event;
event.returnValue = "You have not hit the Submit Button to submit your story yet.";
}
I solved it like that way