I've been exploring the examples of using oejskit (from
[http://www2.openend.se/~pedronis/oejskit/talk/examples.tgz:
<http://www2.openend.se/~pedronis/oejskit/talk/examples.tgz>]) and
they work fine for me.  I wanted to change the  test_open_eval.py to
access the same foo.html via an apache website I'm hosting (it is
static in the original).  I'm envoking with "py.test test" and am
using python2.6, py.test 1.2.1 and oejskit 0.8.8 on a Mac running OS
X.

Original code (test/test_open_eval.py)

from oejskit.testing import BrowserTestClass, JsFailed
class TestOpenEval(BrowserTestClass):

jstests_browser_kind = 'supported'
def test_open_eval(self):

pg = self.open('/static/foo.html')

title = pg.eval('document.title')

assert title == 'Foo'

I changed the open call:

pg = self.open('http://mysite.net/foo.html')
When I re-run the test, the foo.html is loaded into the browser that
is launched as a result of the test, and it is identical (via "View
Frame Source") as the original, but I get the following error:

self = <oejskit.browser_ctl.PageContext object at 0x156dc90>

js = 'document.title', variant = 'eval'
def eval(self, js, variant='eval'):

outcome = self._execute(variant, js, self.root, self.timeout)

if outcome.get('error'):

>           raise JsFailed('[%s] %s' % (self.label, js),
outcome['error'])

E           JsFailed: [[http://ctier.arcode.com:8888/foo.html:
<http://ctier.arcode.com:8888/foo.html>]] document.title: FAILED:

E           message: Result of expression 'frameWin.eval' [undefined]
is not a function.

E           line: 169

E           sourceId: 457014824

E           sourceURL:
[http://localhost:62737/browser_testing/rt/InBrowserTesting.js:
<http://localhost:62737/browser_testing/rt/InBrowserTesting.js>]

E           expressionBeginOffset: 4985

E           expressionCaretOffset: 4998

E           expressionEndOffset: 5004

E           name: TypeError
../../../arcode/python/arcode/js-
infrastructure/oejskit/browser_ctl.py:263: JsFailed


I've dug around in the oejskit code and I don't understand what's
going wrong and I can't find any documentation on this… has anyone
successfully used oejskit to assert against html hosted on a remote
apache?  Or does anyone have any suggestions as to what I might be
doing incorrectly?

foo.html follows below.

Thanks!!!

Simon Smith
[simongsm...@gmail.com: <mailto:simongsm...@gmail.com>]

foo.html:

<html>

<head>

<title>Foo<title>

<script>

</script>

</head>

<body>

</body>

</html>
_______________________________________________
py-dev mailing list
py-dev@codespeak.net
http://codespeak.net/mailman/listinfo/py-dev

Reply via email to