|
-
Aug 5th, 2021, 08:31 AM
#1
Thread Starter
Member
Programatically Click Div Element using GeckoFx 60
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 "Windows Setup"" data-tooltip-align="b,c" data-tooltip-delay="500" data-tooltip-unhoverable="true" data-tooltip="Share "Windows Setup"" 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?
 please 
-
Aug 5th, 2021, 04:43 PM
#2
Re: Programatically Click Div Element using GeckoFx 60
If there is any other way to accomplish your goal, then do that. Trying to automate interactions with a web page is sure to lead to frustration. Web pages change all the time. That may be a div now, but it could be darn near anything else tomorrow. Web designers can't seem to resist the urge to take a page and change everything around, sometimes even including the appearance. That's a button. Is there any reason to think they don't want you clicking it automatically? If so, then that's likely a big part of your problem. Are you the owner of the website? If so, there are better ways than this. If not, then try contacting the owners of the web site. If they don't want you on the site, then why did they put up the page? Therefore, they may well already have an API, or be willing to create one, and that would be a far more reliable solution than anything you can do through the web page.
My usual boring signature: Nothing
 
-
Aug 5th, 2021, 09:55 PM
#3
Thread Starter
Member
Re: Programatically Click Div Element using GeckoFx 60
It's really frustrating. I have been working on it for 4 days. But I could not fix it. It seems like a usual div element but don't know why I can't trigger click event. That is why I think they don't want me clicking that automatically. That is a google drive page document share button. I want to share my documents with my students using different Gmail.
 please 
-
Aug 6th, 2021, 03:22 AM
#4
Re: Programatically Click Div Element using GeckoFx 60
If it is a google drive then there is a fully supported .Net API (for version 2 anyway, not sure of the newer v3 APIs) - https://developers.google.com/drive/...e-sharing#.net
-
Aug 6th, 2021, 04:32 AM
#5
Thread Starter
Member
Re: Programatically Click Div Element using GeckoFx 60
 Originally Posted by PlausiblyDamp
That's what I know. Anyway thanks. But I need multiple Gmail Account to be logged in due to a large number of students.
 please 
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|