硒没有正常工作

时间:2017-11-22 13:10:55

标签: python-3.x selenium web-scraping selenium-chromedriver

from bs4 import BeautifulSoup
from selenium import webdriver
import pdfkit
import time
import logging

driver=webdriver.Chrome()
driver.get('https://www.linkedin.com/')
time.sleep(5)
driver.get('https://www.linkedin.com/in/ankurkhandelwal1/')
time.sleep(20)
soup= BeautifulSoup(driver.page_source, 'lxml')


elem=driver.find_element_by_css_selector(".contact-see-more-less.link-without-visited-state")
elem.click()

for div in soup.select('.pv-contact-info__ci-container'):
    for link in soup.find_all('a', {'class': 'pv-contact-info__contact-link Sans-15px-black-55%'}):
        old=link.get('href')
        mobile=old.replace("tel:", " ")

print(mobile)

elem.click()正在运行,但此行项目未进入下一步并显示移动设备空白。当我删除这一行并手动点击它然后它正在工作。

0 个答案:

没有答案