So I have been trying to make my project more OOP but am having great difficulty getting the driver to pass between the python files.
TestAutomation/
Features/
somefeature.feature
Objects/
main_misc.py
Steps/
actionwords.py
steps.py
Tools/
AutoTools.py
environment.py
environment.py
class DriverSetup:
def get_driver():
...
return webdriver.Firefox(executable_path=path)
def before_all(context):
driver = DriverSetup.get_driver()
context.actionwords = Actionwords()
base_url = ''
driver.get(base_url)
AutoTools.Navigation.wait_for_page_to_load(driver)
AutoTools.py
class Navigation:
def __init__(self,driver):
self.driver = driver
@staticmethod
def wait_for_page_to_load(self):
old_page = self.driver.find_element_by_tag_name('html')
I only gave enough where it gets the error, it will hit the step. In Debug Self has with curent_url with the proper url in place even has a window handle When I step into, it goes back to environment.py to run hook exception - 'WebDriver' object has no attribute 'driver'