def test_page_javascript_raises_javascript_execution_exception(self):
     webPage = JSTestPage(self.driver)
     try:
         webPage.execute_script("return testArrrr")
     except JavascriptExecutionException, e:
         pass
 def test_page_javascript_returns_variable(self):
     webPage = JSTestPage(self.driver)
     jsArray = webPage.execute_script("return testArray")
     self.assertEquals(len(jsArray), 2)
     self.assertEquals(jsArray, [100, 200])
 def test_page_javascript_return_element(self):
     webPage = JSTestPage(self.driver)
     bodyEl = webPage.execute_script('return document.getElementsByTagName("body")[0]')
     self.assertEquals(bodyEl.get_attribute("id"), "jsTestPage")
 def test_page_javascript_returns_document_variable(self):
     webPage = JSTestPage(self.driver)
     title = webPage.execute_script("return document.title")
     self.assertEquals("JS Test Page", title)