Tuesday, 13 August 2013

WebBrowser Invoke Script not working

WebBrowser Invoke Script not working

For some reason this script isn't working:
element.text = "function TestClick() { $('" + testElement + "').click() }";
head.AppendChild(testScript);
webBrowser2.Document.InvokeScript("TestClick");
The webBrowser2 control is on http://google.com, and the variable
testElement equals .gbts. If I run the script $("gbts").click(); on
developer tools in Chrome on Google it works fine, but when I try to
invoke the script into a WebBrowser control I get the error
"$ is undefined"
and nothing happens. What am I doing wrong?

No comments:

Post a Comment