📜  跳过安全检查 selenium linkedin python 代码示例

📅  最后修改于: 2022-03-11 14:45:56.326000             🧑  作者: Mango

代码示例1
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By

email = ""
password = ""
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--start-maximized")
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--disable-notifications")
chrome_options.add_experimental_option('excludeSwitches', ['enable-logging'])
chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
chrome_options.add_experimental_option('useAutomationExtension', False)
driver = webdriver.Chrome(options=chrome_options,executable_path="chromedriver.exe")
driver.get("https://www.linkedin.com/")  WebDriverWait(driver,5).until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR,"#session_key")))
driver.find_element_by_css_selector('#session_key').send_keys(email)
driver.find_element_by_css_selector('#session_password').send_keys(password)
driver.find_element_by_css_selector("body > main > section.section.section--hero > div.sign-in-form-container > form > button").click()
WebDriverWait(driver, 100).until(EC.presence_of_element_located((By.ID, "global-nav")))
print("Login Successful.")