Q: accessing javascript functions/variables outside windows object
Here a copy of a question I mailed to the creators of IeUnit. It is a very generic question, maybe someone somewhere out there in blogspace can help me out on this.
I try to achieve something that I don’t seem to get done…
In IeUnit a window is opened (through cscript) to access my web page using code like:
win = WScript.CreateObject("InternetExplorer.Application");
We then navigate to the page to test:
win.navigate(accesstest.htm”);
where accesstest.htm is a page containing the following html:
<html>
<head>
<title>My test title</title>
<script language="javascript">
var getThis=10;
document.getThat=20;
</script>
</head>
<body>
</body>
</html>
I can now display things like:
win.document.title à My test title
win.document.getThis à 10
but….
How can I access the getThis variable in the page?
And why do I need this: I’m creating an IeUnit extension lib for testing SharePoint pages. I want to access the Web Part Page Services Component, defined in a variable WPSC. But I can’t access this variable from my test classes.