0

I'm using Geckofx 60 to fill a web form. I have to attach an image file also. I can select/click Chose file and Select a file manually. Is there any way to select a local file without opening dialog?

    Dim el As GeckoHtmlElement = GeckoWebBrowser1.DomDocument.GetElementsByTagName("input").FirstOrDefault(Function(elz) elz.GetAttribute("type") = "file")
    Dim fileNames = New IntPtr(0) {}
    Dim domInput = Xpcom.QueryInterface(Of nsIDOMHTMLInputElement)(el.DOMHtmlElement)
    domInput.MozSetFileNameArray(fileNames, CUInt(fileNames.Length)) 'Getting Error
    Marshal.ReleaseComObject(domInput)
    Dim ev As DomEventArgs = GeckoWebBrowser1.Document.CreateEvent("HTMLEvents")
    Dim webEvent = New [Event](GeckoWebBrowser1.Window.DomWindow, TryCast(ev.DomEvent, nsISupports))
    webEvent.InitEvent("change", True, True)
    el.GetEventTarget().DispatchEvent(ev)
    CustomMarshalers.WStringMarshaler().CleanUpNativeData(fileNames)

enter image description here

I have Got the Error above after checking How to choose and upload a local file to a website using Geckofx in C#?

Taki Elias
  • 127
  • 1
  • 7
  • Does this answer your question? [How to choose and upload a local file to a website using Geckofx in C#?](https://stackoverflow.com/questions/56158777/how-to-choose-and-upload-a-local-file-to-a-website-using-geckofx-in-c) It's using `c#`, converting this to `vb.net` shouldn't be difficult. – Trevor Jul 09 '21 at 15:29
  • I tried this. This does not work on v 60. – Taki Elias Jul 09 '21 at 15:35
  • Can you update your post then to include what you've tried? This will help other users know what you've tried so they are not suggesting solutions that you've tried. – Trevor Jul 09 '21 at 15:37
  • Can you also expand on `This does not work on v 60`, what was the issues if any, was there errors? – Trevor Jul 09 '21 at 15:38
  • Please check now. – Taki Elias Jul 09 '21 at 15:44

0 Answers0