fork download
  1. from selenium import webdriver
  2. from selenium.webdriver.common.by import By
  3. from selenium.webdriver.support.ui import Select
  4. from selenium.common.exceptions import NoSuchElementException
  5. import unittest, time, re
  6.  
  7. class Gary(unittest.TestCase):
  8. def setUp(self):
  9. self.driver = webdriver.Firefox()
  10. self.driver.implicitly_wait(30)
  11. self.base_url = "http://w...content-available-to-author-only...o.in/"
  12. self.verificationErrors = []
  13.  
  14. def test_gary(self):
  15. driver = self.driver
  16. driver.get(self.base_url + "/")
  17. driver.find_element_by_id("lst-ib").clear()
  18. driver.find_element_by_id("lst-ib").send_keys("selenium webdriver")
  19. driver.find_element_by_id("lst-ib").clear()
  20. driver.find_element_by_id("lst-ib").send_keys("selenium webdriver python")
  21. # ERROR: Caught exception [Error: locator strategy either id or name must be specified explicitly.]
  22. driver.find_element_by_xpath("//ol[@id='rso']/li[10]/div/h3/a/em[2]").click()
  23. self.assertEqual("Selenium's WebDriver & Python: Dealing with script timeouts", driver.find_element_by_css_selector("h3").text)
  24.  
  25. def is_element_present(self, how, what):
  26. try: self.driver.find_element(by=how, value=what)
  27. except NoSuchElementException, e: return False
  28. return True
  29.  
  30. def tearDown(self):
  31. self.driver.quit()
  32. self.assertEqual([], self.verificationErrors)
  33.  
  34. if __name__ == "__main__":
  35. unittest.main()
  36.  
Runtime error #stdin #stdout #stderr 0s 17496KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Bareword found where operator expected at prog.pl line 10, near ")
        self"
	(Missing operator before self?)
Bareword found where operator expected at prog.pl line 11, near ")
        self"
	(Missing operator before self?)
Bareword found where operator expected at prog.pl line 12, near "self"
	(Missing semicolon on previous line?)
Bareword found where operator expected at prog.pl line 14, near "def"
	(Missing semicolon on previous line?)
Bareword found where operator expected at prog.pl line 17, near ")
        driver"
	(Missing operator before driver?)
Bareword found where operator expected at prog.pl line 18, near ")
        driver"
	(Missing operator before driver?)
Bareword found where operator expected at prog.pl line 19, near ")
        driver"
	(Missing operator before driver?)
Bareword found where operator expected at prog.pl line 20, near ")
        driver"
	(Missing operator before driver?)
Bareword found where operator expected at prog.pl line 22, near ")
        # ERROR: Caught exception [Error: locator strategy either id or name must be specified explicitly.]
        driver"
	(Missing operator before driver?)
Bareword found where operator expected at prog.pl line 23, near ")
        self"
	(Missing operator before self?)
Bareword found where operator expected at prog.pl line 25, near ")
    
    def"
	(Missing operator before def?)
Bareword found where operator expected at prog.pl line 27, near ")
        except"
	(Missing operator before except?)
Bareword found where operator expected at prog.pl line 32, near ")
        self"
	(Missing operator before self?)
syntax error at prog.pl line 7, near "):"
Execution of prog.pl aborted due to compilation errors.