from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import time

driver = webdriver.Chrome('C:\Ahad\Apps\chromedriver_win32\chromedriver.exe')
driver.implicitly_wait(10)
driver.maximize_window()
driver.get("http://localhost:3000/login");
time.sleep(1)
driver.find_element_by_link_text("Sign-up").click()
time.sleep(2)
driver.find_element_by_name("fullName").click()
driver.find_element_by_name("fullName").clear()
driver.find_element_by_name("fullName").send_keys("Viswa Teja")
time.sleep(1)
driver.find_element_by_xpath("//div[@id='root']/div/div/div/div").click()
driver.find_element_by_name("userName").click()
driver.find_element_by_name("userName").clear()
driver.find_element_by_name("userName").send_keys("viswa.4oct@gmail.com")
time.sleep(1)
driver.find_element_by_xpath("//div[@id='root']/div/div/div/div").click()
driver.find_element_by_name("password").click()
driver.find_element_by_name("password").clear()
driver.find_element_by_name("password").send_keys("qwerty")
time.sleep(1)
driver.find_element_by_name("userType").click()
Select(driver.find_element_by_name("userType")).select_by_visible_text("STUDENT")
time.sleep(1)
driver.find_element_by_name("userType").click()
driver.find_element_by_name("confirmPassword").click()
driver.find_element_by_name("confirmPassword").clear()
driver.find_element_by_name("confirmPassword").send_keys("qwerty")
time.sleep(1)
driver.find_element_by_css_selector("svg.react-datetime-picker__calendar-button__icon.react-datetime-picker__button__icon").click()
time.sleep(1)
driver.find_element_by_xpath("//div[@id='root']/div/div/div/div/div/div/div/form/div[5]/span/div/div/div/button[3]/span").click()
time.sleep(1)
driver.find_element_by_xpath("//div[@id='root']/div/div/div/div/div/div/div/form/div[5]/span/div/div/div/button[3]/span").click()
time.sleep(1)
driver.find_element_by_xpath("(//button[@type='button'])[4]").click()
time.sleep(1)
driver.find_element_by_xpath("(//button[@type='button'])[4]").click()
time.sleep(1)
driver.find_element_by_xpath("(//button[@type='button'])[4]").click()
time.sleep(1)
driver.find_element_by_xpath("(//button[@type='button'])[12]").click()
time.sleep(1)
driver.find_element_by_xpath("//div[@id='root']/div/div/div/div/div/div/div/form/div[5]/span/div/div/div[2]/div/div/button[10]/abbr").click()
time.sleep(1)
driver.find_element_by_xpath("(//button[@type='button'])[17]").click()
driver.find_element_by_link_text("Existing user").click()
time.sleep(1)
driver.find_element_by_name("userName").click()
driver.find_element_by_name("userName").clear()
driver.find_element_by_name("userName").send_keys("viswa.4oct@gmail.com")
time.sleep(1)
driver.find_element_by_xpath("//div[@id='root']/div/div/div/div/div").click()
driver.find_element_by_name("password").click()
driver.find_element_by_name("password").clear()
driver.find_element_by_name("password").send_keys("qwerty")
time.sleep(1)
driver.find_element_by_name("userType").click()
Select(driver.find_element_by_name("userType")).select_by_visible_text("STUDENT")
time.sleep(1)
driver.find_element_by_name("userType").click()
driver.find_element_by_xpath("//button[@type='submit']").click()
time.sleep(1)
driver.quit()