<gh_stars>0
import unittest
from selenium import webdriver
from selenium.webdriver.common.by import By
import time


class TestcaseDemo(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        print("setting up data")
        global driver
        chromedriver = "C:/Users/Abhijeet/OneDrive/Desktop/dmw_mini/code/chromedriver.exe"
        driver = webdriver.Chrome(chromedriver)
        driver.get("http://127.0.0.1:8000/")
        driver.maximize_window()

    def test_1loginValid(self):
        print("Testing  Valid login in execution")
        driver.find_element_by_name('userid').send_keys('<PASSWORD>')
        driver.find_element_by_name('password').send_keys('<PASSWORD>')
        signbutton = driver.find_element_by_name('signbut')
        signbutton.click()
        time.sleep(5)

    def test_2logout(self):
        print("Testing logout ")
        time.sleep(6)

        link = driver.find_element_by_partial_link_text('LOGOUT')
        link.click()

    def test_3loginInvalid(self):
        print("Testing InValid login in execution")
        driver.find_element_by_name('userid').send_keys('abc@a.c')
        driver.find_element_by_name('password').send_keys('<PASSWORD>')
        signbutton = driver.find_element_by_name('signbut')
        time.sleep(5)
        signbutton.click()
        time.sleep(6)

    def test_4loginValid(self):
        print("Testing Valid login in execution")
        driver.find_element_by_name('userid').send_keys('<PASSWORD>')
        driver.find_element_by_name('password').send_keys('<PASSWORD>')
        signbutton = driver.find_element_by_name('signbut')
        time.sleep(5)
        signbutton.click()
        time.sleep(6)

    def test_5knnresult(self):
        print("Checking KNN Result")
        time.sleep(5)

        driver.find_element_by_name('pelinc').send_keys('10')
        driver.find_element_by_name('pelti').send_keys('10')
        driver.find_element_by_name('lumlor').send_keys('10')
        driver.find_element_by_name('sacral').send_keys('10')
        driver.find_element_by_name('pelrad').send_keys('10')
        driver.find_element_by_name('degree').send_keys('10')
        knn = driver.find_element_by_name('knn')
        time.sleep(5)
        knn.click()
        time.sleep(5)

    def test_6naiveresult(self):
        print("Checking Naive Bayes Result")
        # driver.find_element_by_name('pelinc').send_keys('10')
        # driver.find_element_by_name('pelti').send_keys('10')
        # driver.find_element_by_name('lumlor').send_keys('10')
        # driver.find_element_by_name('sacral').send_keys('10')
        # driver.find_element_by_name('pelrad').send_keys('10')
        # driver.find_element_by_name('degree').send_keys('10')
        time.sleep(5)
        naive = driver.find_element_by_name('naive')
        naive.click()
        time.sleep(6)

    def test_7logout(self):
        print("Testing logout ")
        link = driver.find_element_by_partial_link_text('LOGOUT')
        link.click()

    @classmethod
    def tearDownClass(cls):
        print("tearDown execution")
        time.sleep(6)
        driver.quit()


unittest.main()

import unittest
from selenium import webdriver
from selenium.webdriver.common.by import By
import time


class TestcaseDemo(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        print("setting up data")
        global driver
        chromedriver = "C:/Users/Abhijeet/OneDrive/Desktop/dmw_mini/code/chromedriver.exe"
        driver = webdriver.Chrome(chromedriver)
        driver.get("http://127.0.0.1:8000/")
        driver.maximize_window()

    def test_1loginValid(self):
        print("Testing  Valid login in execution")
        driver.find_element_by_name('userid').send_keys('<PASSWORD>')
        driver.find_element_by_name('password').send_keys('<PASSWORD>')
        signbutton = driver.find_element_by_name('signbut')
        signbutton.click()
        time.sleep(5)

    def test_2logout(self):
        print("Testing logout ")
        time.sleep(6)

        link = driver.find_element_by_partial_link_text('LOGOUT')
        link.click()

    def test_3loginInvalid(self):
        print("Testing InValid login in execution")
        driver.find_element_by_name('userid').send_keys('abc@a.c')
        driver.find_element_by_name('password').send_keys('<PASSWORD>')
        signbutton = driver.find_element_by_name('signbut')
        time.sleep(5)
        signbutton.click()
        time.sleep(6)

    def test_4loginValid(self):
        print("Testing Valid login in execution")
        driver.find_element_by_name('userid').send_keys('<PASSWORD>')
        driver.find_element_by_name('password').send_keys('<PASSWORD>')
        signbutton = driver.find_element_by_name('signbut')
        time.sleep(5)
        signbutton.click()
        time.sleep(6)

    def test_5knnresult(self):
        print("Checking KNN Result")
        time.sleep(5)

        driver.find_element_by_name('pelinc').send_keys('10')
        driver.find_element_by_name('pelti').send_keys('10')
        driver.find_element_by_name('lumlor').send_keys('10')
        driver.find_element_by_name('sacral').send_keys('10')
        driver.find_element_by_name('pelrad').send_keys('10')
        driver.find_element_by_name('degree').send_keys('10')
        knn = driver.find_element_by_name('knn')
        time.sleep(5)
        knn.click()
        time.sleep(5)

    def test_6naiveresult(self):
        print("Checking Naive Bayes Result")
        # driver.find_element_by_name('pelinc').send_keys('10')
        # driver.find_element_by_name('pelti').send_keys('10')
        # driver.find_element_by_name('lumlor').send_keys('10')
        # driver.find_element_by_name('sacral').send_keys('10')
        # driver.find_element_by_name('pelrad').send_keys('10')
        # driver.find_element_by_name('degree').send_keys('10')
        time.sleep(5)
        naive = driver.find_element_by_name('naive')
        naive.click()
        time.sleep(6)

    def test_7logout(self):
        print("Testing logout ")
        link = driver.find_element_by_partial_link_text('LOGOUT')
        link.click()

    @classmethod
    def tearDownClass(cls):
        print("tearDown execution")
        time.sleep(6)
        driver.quit()


unittest.main()
# driver.find_element_by_name('pelinc').send_keys('10') # driver.find_element_by_name('pelti').send_keys('10') # driver.find_element_by_name('lumlor').send_keys('10') # driver.find_element_by_name('sacral').send_keys('10') # driver.find_element_by_name('pelrad').send_keys('10') # driver.find_element_by_name('degree').send_keys('10')