Код: Выделить всё
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
chrome_options = Options()
chrome_options.add_experimental_option("detach", True)
chrome_options.add_argument("--disable-webrtc")
chrome_options.add_argument("--disable-features=WebRTC-HW-Decoding,WebRTC-HW-encoding,WebRTC-Support-Local-IP")
cService =
webdriver.ChromeService(executable_path=r"C:\Users\quahe\Downloads\chromedriver-win64\chromedriver-win64\chromedriver.exe")
driver = webdriver.Chrome(service = cService, options=chrome_options)
def login_to_linkedin(email, password):
linkedin_login_url = "https://www.linkedin.com/login"
driver.get(linkedin_login_url)
email_field = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, "username"))
)
email_field.send_keys(email)
password_field = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, "password"))
)
password_field.send_keys(password)
login_button = WebDriverWait(driver, 10).until(
EC.element_to_be_clickable((By.XPATH, '//button[@type="submit"]'))
)
login_button.click()
time.sleep(4)
new_url= driver.current_url
driver.get(new_url)
verify_button = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, '//*[@id="home_children_button"]')))
verify_button.click()
п>
Подробнее здесь: https://stackoverflow.com/questions/790 ... utomate-li