Reputation: 3039
In AngleSharp IHtmlAnchorElement
has DoClick()
method.
In my case I need to click a div
. How can I do it?
HTML:
<div role="button" class="div"></div>
C#:
IHtmlAnchorElement anc = document.Anchors.First(x => x.ClassName == "anc");
anc.DoClick();
IElement div = document.All.First(x => x.ClassName == "div");
//! DoClick on div?
Upvotes: 4
Views: 3278
Reputation:
A quick Look into the code i foundout that the IHtmlElement
interfaces is the one that holds the DoClick();
Method.
That Interface documentation says:
The HTMLElement interface represents any HTML element. Some elements directly implement this interface, other implement it via an interface that inherit it.
So it actually is fitting for your needs, rather than the more Abstract interface IElement
which IHtmlElement
inherits from.
This should make it appear.
IHtmlElement div = document.All.First(x => x.ClassName == "div");
div.DoClick();
Upvotes: 2