def setup(request, browser):
    wdf = WebDriverFactory(browser)
    driver = wdf.getwebdriverinstance()
    lp = LoginPage(driver)
    lp.login("*****@*****.**", "abcabc")

    print("I will run only at first method")
    # if browser == 'firefox':
    #     print("running firefox")

    # if browser == 'chrome':
    #     baseURL = "https://letskodeit.teachable.com/"
    #     driver = webdriver.Chrome(executable_path="C:\\Selenium\\chromedriver.exe")
    #     driver.maximize_window()
    #     driver.implicitly_wait(5)
    #     driver.get(baseURL)
    #     print('running chrome')
    #
    # else:
    #     driver = webdriver.firefox
    #     print('not a valid browser')

    if request.cls is not None:
        request.cls.driver = driver

    yield driver
    driver.quit()
    print("I will run at last ")
예제 #2
0
def onetimesetup(request, browser):
    print("This will run once at the start of test")
    wdf = WebDriverFactory(browser)
    driver = wdf.getwebdriverinstance()

    if request.cls is not None:
        request.cls.driver = driver

    yield driver
    driver.quit()
    print("This will run once at the end of test")