c# - GeckoFX - implement search function - how to use nsIWebBrowserFind interface -
could perhaps tell me how should use nsiwebbrowserfind interface in geckofx find strings on webpage?
i tried following code, throws me argumentnullexception - parameter cannot null (punk).
i have no idea means, have never used interfaces before.
geckowebbrowser browser = getcurrentbrowser(); nsiwebbrowserfind finder = browser.getinterface<nsiwebbrowserfind>(); finder.setsearchstringattribute(searchbox1.text); finder.findnext();
i have tried
nsiwebbrowserfind finder = gecko.xpcom.getinterface<nsiwebbrowserfind>(browser);
with same results:(
please help:)
thanks!
this works in geckofx 29.0:
var field = typeof(geckowebbrowser).getfield("webbrowser", bindingflags.instance | bindingflags.nonpublic); nsiwebbrowser browser = (nsiwebbrowser)field.getvalue(webbrowser1); var browserfind = xpcom.queryinterface<nsiwebbrowserfind>(browser); browserfind.setsearchstringattribute(search); try { browserfind.setwrapfindattribute(true); browserfind.findnext(); } catch { }
some websites frames throws exception after last result however, seems bug in geckofx. did workaround falling javascript find (javascript:window.find) when exception thrown.
Comments
Post a Comment