Here is my Python Script
Expand|Select|Wrap|Line Numbers
- from selenium import selenium
- import unittest
- class SignUpTask(unittest.TestCase):
- """ The following needs to have the issues corrected to make
- it run. When the run is completed the answer for question
- 2 will be shown"""
- def setUp(self):
- self.selenium = selenium("localhost", 4444, "*firefox",
- "http://www.google.com/")
- self.selenium.start()
- def test_that_will_print_out_a_url_as_answer_for_task(sel):
- self.selenium.open("/")
- self.selenium.click("link=Web QA")
- self.selenium.wait_for_page_to_load("30000")
- self.selenium.click("link=Get Involved")
- self.selenium.wait_for_page_to_load("30000")
- url = self.selenium.get_attribute("//ol/li[5]/a@href")
- print """The Url below needs to be entered as the answer
- for Question 2) in the signup task"""
- print "URL is: %s" % url
- def tearDown(self):
- self.selenium.stop()
- if __name__ == "__main__":
- unittest.main()
================================================== ====================
ERROR: test_that_will_print_out_a_url_as_answer_for_task (__main__.SignUpTask)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/eanderson/Desktop/TestFiles/Selenium1.py", line 16, in test_that_will_print_out_a_url_as_answer_for_task
self.selenium.open("/")
NameError: global name 'self' is not defined
----------------------------------------------------------------------
Ran 1 test in 24.577s
Could anyone help me with this "NameError: global name 'self' is not defined" error so my script can parse?
Thank You!!
.erik