
# https://www.globalsino.com/ICs/
# Login MS Teams

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from time import sleep
import time
from LoginCredentials import userName,password

ser = Service(r"C:\usr\local\bin\chromedriver.exe") 
driver = webdriver.Chrome(service=ser) 
time.sleep(2)
driver.implicitly_wait(3)
driver.maximize_window()
time.sleep(2)


driver.get('https://www.microsoft.com/en-in/microsoft-365/microsoft-teams/group-chat-software')

time.sleep(7)


driver.find_element(By.XPATH, "/html/body/div[3]/div/div[2]/main/div/div/div/div[2]/section/div/div[2]/div/div/div/div/div/div[3]/a").click()
# driver.find_element_by_xpath('/html/body/section/div[1]/div/div/div/section/div/div[2]/div[2]/a').click()

driver.switch_to.window(driver.window_handles[1])#switching to tab 1
time.sleep(5)

driver.find_element(By.XPATH, "/html/body/div/form[1]/div/div/div[2]/div[1]/div/div/div/div/div[1]/div[3]/div/div/div/div[2]/div[2]/div/input[1]").send_keys(userName)
#driver.switch_to_active_element().send_keys(userName)
time.sleep(2)
driver.find_element(By.XPATH, "/html/body/div/form[1]/div/div/div[2]/div[1]/div/div/div/div/div[1]/div[3]/div/div/div/div[4]/div/div/div/div[2]/input").click()

#driver.find_element_by_xpath('//input[@class="button ext-button primary ext-primary"]').click()
print('Username Entered')
time.sleep(3)

driver.find_element(By.XPATH, "/html/body/div/form[1]/div/div/div[2]/div[1]/div/div/div/div/div/div[3]/div/div[2]/div/div[4]/div/div/div/div/input").click()
time.sleep(15)

driver.find_element(By.XPATH, "/html/body/div/form/div/div/div[2]/div[1]/div/div/div/div/div/div[3]/div/div[2]/div/div[3]/div[2]/div/div/div[2]/input").click()
time.sleep(5)

'''
driver.find_element(By.XPATH, "").send_keys(password)
#driver.switch_to_active_element().send_keys(userName)
time.sleep(2)
driver.find_element(By.XPATH, "").click()

#driver.find_element_by_xpath('//input[@class="button ext-button primary ext-primary"]').click()
print('Password Entered')
time.sleep(5)
'''
