Project structure:
WebTeam
__init__.py
BasePage.py
UIMap.py
Pages:
__init__.py
Common.py
ContactPage.py
test:
__init__.py
CompetitorsTest.py
CreateAnonData.py
CreateKnownData.py
The code:
import unittest
import time
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.action_chains import ActionChains
from BasePage import BasePage
from UIMap import tomcat8LoginPage, tomcat8urls, competitors
class test_Competitors(unittest.TestCase, BasePage):
def setup(self):
self.driver = webdriver.Firefox()
self.driver.get(tomcat8urls ['loginPageTomcat8'])
def test_Compete(self):
driver = self.driver
actions = ActionChains(driver)
### Log-in and navigate to Competitors page ###
self.fill_out_field\
("id",
tomcat8LoginPage ['usernameField'],'username2092')
self.fill_out_field\
("id",
tomcat8LoginPage['passwordField'],'Password2092')
self.click\
("id",
tomcat8LoginPage ['loginBtn'])
driver.get(tomcat8urls ['newUIurl'])
self. click\
("xpath",
competitors ['inboundMenu'])
This is the latest error I have gotten:
Traceback (most recent call last):
File "CompetitorsTest.py", line 18, in test_Compete
driver = self.driver
AttributeError: 'test_Competitors' object has no attribute 'driver'