Advertisement
yasi04

Untitled

Apr 7th, 2024
1,482
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.26 KB | None | 0 0
  1. import time
  2. import selenium.webdriver as webdriver
  3. from selenium.webdriver.common.by import By
  4. from selenium.webdriver.common.keys import Keys
  5. from selenium.webdriver.chrome.options import Options
  6. from selenium.webdriver.chrome.service import Service
  7.  
  8.  
  9. url = "https://www.vk.com/login"
  10. chrome_driver_path = "E://PyCharm_Community_Edition_2023.3.2//scripts//chromedriver//chromedriver"
  11.  
  12. service = Service(chrome_driver_path)
  13.  
  14. chrome_options = Options()
  15. chrome_options.add_argument("--no-sandbox")
  16. chrome_options.add_argument("--disable-dev-shm-usage")
  17. chrome_options.add_argument("--disable-gpu")
  18. chrome_options.add_argument("--window-size=1920,1080")
  19.  
  20.  
  21. driver = webdriver.Chrome(service=service, options=chrome_options)
  22.  
  23. try:
  24.     driver.get(url=url)
  25.     time.sleep(10)
  26.  
  27.     email_input = driver.find_element(By.ID, "index_email")
  28.     email_input.clear()
  29.     email_input.send_keys("89958832335")
  30.     time.sleep(3)
  31.  
  32.     enter = driver.find_element(By.XPATH, "/html/body/div[10]/div/div/div[2]/div[2]/div[3]/div/div[1]/form/button/span/span")
  33.     enter.click()
  34.     time.sleep(4)
  35.  
  36.     password = driver.find_element(By.XPATH, "/html/body/div[1]/div/div/div/div/div[1]/div[2]/div/div/div/form/div[1]/div[3]/div/div/input")
  37.     password.send_keys("Uekmrf1354")
  38.     time.sleep(4)
  39.  
  40.     enter = driver.find_element(By.XPATH, "/html/body/div[1]/div/div/div/div/div[1]/div[2]/div/div/div/form/div[2]/button[1]/span[1]/span/span")
  41.     enter.click()
  42.     time.sleep(4)
  43.  
  44.     enter = driver.find_element(By.XPATH, "/html/body/div[11]/div/div/div[2]/div[1]/div/div[1]/div/div/nav/ol/li[3]/a/span/span")
  45.     enter.click()
  46.     time.sleep(4)
  47.  
  48.     enter = driver.find_element(By.XPATH, "/html/body/div[11]/div/div/div[2]/div[2]/div[3]/div/div/div/div[2]/ul/div[1]/div[1]/div/div[1]/li[3]/div[2]/div/div[2]/div[1]")
  49.     enter.click()
  50.     time.sleep(4)
  51.  
  52.     chat = driver.find_element(By.XPATH, "/html/body/div[11]/div/div/div[2]/div[2]/div[3]/div/div/div/div[3]/div[2]/div[4]/div[4]/div[4]/div[1]/div[4]")
  53.     chat.send_keys("Расписание")
  54.     chat.send_keys(Keys.ENTER)
  55.     time.sleep(5)
  56.     chat.send_keys("ИКБО-21-22")
  57.     chat.send_keys(Keys.ENTER)
  58.     time.sleep(10)
  59.    
  60.  
  61. except Exception as ex:
  62.     print(ex)
  63. finally:
  64.     driver.close()
  65.     driver.quit()
  66.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement