Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15804

VS 2019 Programatically Click Div Element using GeckoFx 60

$
0
0
I am having a tough time clicking a div element through GeckoFX 60 VB.NET. I also tried to use element.click() but It does not work.

Here is my code for DispatchEvent :

Code:

Dim ev As DomEventArgs = GeckoWebBrowser1.Document.CreateEvent("MouseEvent")
Dim webEvent = New Gecko.WebIDL.[Event](GeckoWebBrowser1.Window.DomWindow, TryCast(ev.DomEvent, nsISupports))
webEvent.InitEvent("click", True, False)
element.GetEventTarget().DispatchEvent(ev)

Nothing happens after dispatching the click event.

This is the Button HTML

HTML Code:


<div class="h-sb-Ic h-R-d a-c-d" role="button" style="user-select: none;" aria-hidden="false" aria-disabled="false" aria-label="Share &quot;Windows Setup&quot;" data-tooltip-align="b,c" data-tooltip-delay="500" data-tooltip-unhoverable="true" data-tooltip="Share &quot;Windows Setup&quot;" tabindex="0"><div class="a-d-c"><svg class="a-s-fa-Ha-pa" width="24px" height="24px" viewBox="0 0 24 24" focusable="false" fill="#000000"><path d="M9 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0-6c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zm0 7c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4zm6 5H3v-.99C3.2 16.29 6.3 15 9 15s5.8 1.29 6 2v1zm3-4v-3h-3V9h3V6h2v3h3v2h-3v3h-2z"></path></svg></div></div>

Is there any other way to trigger the click event of the above div?

Viewing all articles
Browse latest Browse all 15804

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>