Advertisement
Guest User

Untitled

a guest
May 12th, 2021
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. from selenium.webdriver.support import expected_conditions as EC
  2. from selenium.webdriver.support.ui import WebDriverWait
  3. from selenium import webdriver as wd
  4. from selenium.webdriver.common.by import By
  5. import time
  6. import datetime
  7. e = datetime.datetime.now()
  8. day = (e.strftime("%a"))
  9.  
  10.  
  11.  
  12. executable_path = "F:\Python\chromedriver.exe"
  13. driver = wd.Chrome(executable_path) # for chrome. wd.Firefox() would be for firefox
  14. driver.get("https://teams.microsoft.com")
  15.  
  16. EMAILFIELD = (By.ID, "i0116")
  17. PASSWORDFIELD = (By.ID, "i0118")
  18. NEXTBUTTON = (By.ID, "idSIButton9")
  19.  
  20.  
  21.  
  22. # wait for email field and enter email
  23. WebDriverWait(driver, 10).until(EC.element_to_be_clickable(EMAILFIELD)).send_keys("[email protected]")
  24.  
  25. # Click Next
  26. WebDriverWait(driver, 10).until(EC.element_to_be_clickable(NEXTBUTTON)).click()
  27.  
  28. # wait for password field and enter password
  29. WebDriverWait(driver, 10).until(EC.element_to_be_clickable(PASSWORDFIELD)).send_keys("thisismypassword")
  30.  
  31. # Click Login - same id?
  32. WebDriverWait(driver, 10).until(EC.element_to_be_clickable(NEXTBUTTON)).click()
  33.  
  34. # Yes button always remember
  35. driver.find_element_by_xpath('//input[@class="button ext-button primary ext-primary"]').click()
  36. time.sleep(20)
  37.  
  38.  
  39.  
  40. physics = "https://teams.microsoft.com/_#/school/conversations/General?threadId=19:[email protected]&ctx=channel"
  41. math = "https://teams.microsoft.com/_#/school/conversations/General?threadId=19:[email protected]&ctx=channel"
  42. electrical = "https://teams.microsoft.com/_#/school/conversations/General?threadId=19:[email protected]&ctx=channel"
  43. mechanical = "https://teams.microsoft.com/_#/school/conversations/General?threadId=19:[email protected]&ctx=channel"
  44. cs = "https://teams.microsoft.com/_#/school/conversations/General?threadId=19:[email protected]&ctx=channel"
  45.  
  46. driver.get(physics)
  47. driver.find_element_by_xpath('//input[@class=""]').click()
  48.  
  49. # time.sleep(2750)
  50.  
  51.  
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement