2
I would like to know how to perform a click on a button of an internet site even by clicking on such web element debugged in the browser itself.
I’m using the webbrowser component of C#
I have tried some methods here, but without success, even using Getelementsbytagname
and the html of the site is like this.
<button type="button" ng-click="confirmarPresenca()">ENTRADA</button>
I tried with the following code but unsuccessfully in my Windows Form Application C#
HtmlElementCollection el = webBrowser1.Document.GetElementsByTagName("button");
foreach(HtmlElement btn in el)
{
if(btn.GetAttribute("type").Equals("button")
{
btn.InvokeMember("click");
}
}
Which version of Asp.net vc are you using? It’s webforms or MVC?
– anmaia
please specify your context better, using the Webbrowser component of C# or in a web browser?
– Marciano.Andrade
In my answer, I inputei "absolutely nothing to do with C#" - which may be a misunderstanding. Looking at the nomenclature he used (Webbrowser + C#), it looks so much like Webforms - that I never worked. I’m waiting for an update from him to go ahead.
– Guilherme Oderdenge
It would be a webbrowser component of c#. Look at an example link of how it would be more or less my doubt, but the html part of the site would be equal to the one I mentioned above http://answall.com/questions/17003/simular-click-no-webbrowser-usando-c
– SNOT
Did you ever debug the code to try to identify where exactly the problem is? You could check: (1) if
el
contains something, (2) whatGetAttribute("type")
returns and (3) if this return is equal to"button"
tiny, and share in the question. It would make it a bit easier for someone to help you. :)– Luiz Vieira
Dude I don’t understand I may be half a poof but that would be it: You want to click a button set on
aspx
by means of code Behind?– Bruno Casali