M
Matthew Lock
Hello,
I am automating Internet Explorer in order to do some simple automated
testing of a web application. How do I invoke Javascript functions in
the web page I load?
I can successfully start an instance of Internet Explorer and control
the DOM, but I don't know how to call Javascript functions. Here is
the code I am using so far:
public class WebBrowser
{
public SHDocVw.InternetExplorerClass ie;
public WebBrowser( string url )
{
ie = new SHDocVw.InternetExplorerClass();
ie.Visible = true;
Object Flags = null, TargetFrameName = null, PostData = null,
Headers = null;
ie.Navigate( url, ref Flags, ref TargetFrameName, ref PostData, ref
Headers );
while( ie.Busy )
{
Thread.Sleep( 500 );
}
mshtml.HTMLDocumentClass document =
((mshtml.HTMLDocumentClass)ie.Document);
// here is where I would like to invoke a javascript function in my
document
ie.Quit();
}
}
I am automating Internet Explorer in order to do some simple automated
testing of a web application. How do I invoke Javascript functions in
the web page I load?
I can successfully start an instance of Internet Explorer and control
the DOM, but I don't know how to call Javascript functions. Here is
the code I am using so far:
public class WebBrowser
{
public SHDocVw.InternetExplorerClass ie;
public WebBrowser( string url )
{
ie = new SHDocVw.InternetExplorerClass();
ie.Visible = true;
Object Flags = null, TargetFrameName = null, PostData = null,
Headers = null;
ie.Navigate( url, ref Flags, ref TargetFrameName, ref PostData, ref
Headers );
while( ie.Busy )
{
Thread.Sleep( 500 );
}
mshtml.HTMLDocumentClass document =
((mshtml.HTMLDocumentClass)ie.Document);
// here is where I would like to invoke a javascript function in my
document
ie.Quit();
}
}