Reputation: 5314
Im trying to inject javascript into my GeckoFX Browser by using the following code..
GeckoWebBrowser browser = ....;
using (AutoJSContext context = new AutoJSContext(browser.JSContext))
{
string result;
context.EvaluateScript("3 + 2;", out result)
}
From another SO post found here: How Can Execute Javascript Commands via GeckoFX
But I get an error:
'Gecko.GeckoWebBrowser' does not contain a definition for 'JSContext' and no extension method 'JSContext' accepting a first argument of type 'Gecko.GeckoWebBrowser' could be found(are you missing a using directive or an assembly reference?)
Fairly new to C# and Im not quite sure what Im missing? Ive been searching and troubleshooting for hours and have not found a solution as to what Im overlooking and or missing. Would greatly appreciate if someone shined some light on this. Thanks!!
Upvotes: 1
Views: 2277
Reputation: 1784
It appears that in version 22, the JSContext has been moved down a level, to the Window.
So now you'll want
using (AutoJSContext context = new AutoJSContext(browser.Window.JSContext))
I found this in the new unit tests.
Upvotes: 5