尝试使用 selenium 自动化并从 LinkedIn 抓取信息

问题描述 投票:0回答:1

我想登录 LinkedIn 帐户,然后搜索一家公司并抓取公司数据,但是在我自动化登录过程后,我不断收到以下错误

[26224:25040:0314/123926.899:ERROR:cert_verify_proc_builtin.cc(677)] ponf.linkedin.com 的 CertVerifyProcBuiltin 失败: 证书 i=0 (CN=ponf.linkedin.com,O=LinkedIn Corporation,L=桑尼维尔,ST=加利福尼亚州,C=美国) ----- 错误:时间晚于 notAfter

[31640:27472:0314/123926.904:错误:ssl_client_socket_impl.cc(992)]握手失败;返回 -1,SSL 错误代码 1,net_error -201 [31640:27472:0314/124052.228:错误:ssl_client_socket_impl.cc(992)]握手失败;返回 -1,SSL 错误代码 1,net_error -107 [29816:30512:0314/124106.578:错误:gpu_init.cc(525)]不支持直通,GL被禁用,ANGLE是 [26224:25040:0314/124107.401:ERROR:cert_issuer_source_aia.cc(34)] 解析从 AIA 检索的证书时出错(作为 DER): 错误:无法将 tbsCertificate 读取为 SEQUENCE 错误:解析证书失败

这是我到目前为止写的代码

# Importing libraries
import os
import time
import selenium 
from selenium.webdriver.common.by import By
from selenium import webdriver
from selenium.webdriver.support.ui import Select
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import pandas as pd

# print(selenium.__version__)
#To make sure the browser does not close after automation
options = Options()
options.add_experimental_option("detach", True)

driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)

url = "https://www.linkedin.com/"

actions = ActionChains(driver)

#Opens browser and goes to the link, and maximizes the browser
driver.get(url)
driver.maximize_window()

sign_in = ['[email protected]', 'Test123@']
key = ['FlutterWave','Data Analysts', 'Nigeria', '']

# Sleep the script for 20 seconds
time.sleep(20)

#Inputting the email address
driver.find_element(By.XPATH, '//*[@id="session_key"]').send_keys(sign_in[0])

#Wait till the password element is visible
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="session_password"]')))

#Inputting the password 
driver.find_element(By.XPATH, '//*[@id="session_password"]').send_keys(sign_in[1])

#Clicking on the sign in button
driver.find_element(By.XPATH, 
                    '//*[@id="main-content"]/section[1]/div/form[1]/div[2]/button').click()

# Sleep the script till you can type in the verification code
time.sleep(30)





search = driver.find_element(By.XPATH, '//*[@id="global-nav-typeahead"]/input')
search.send_keys(key[0])
search.send_keys(Keys.ENTER)
python selenium-webdriver web-scraping web webautomation
1个回答
0
投票

您尝试过这些选项吗?

Options = webdriver.ChromeOptions() Options.add_argument('--ignore-certificate-errors') Options.add_argument('--ignore-ssl-errors') driver = webdriver.Chrome(Options)

© www.soinside.com 2019 - 2024. All rights reserved.