deepin 编译安装 python3.10 | Deepin Python3 Selenium ChromeDriver的安装 | Selenium ChromeDriver的说明
import re,time
from selenium import webdriver
from selenium.webdriver.common.by import By
options = webdriver.ChromeOptions()
options.add_argument('lang=zh_CN.UTF-8')
options.add_argument('user-agent="Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0"')
driver = webdriver.Chrome(options=options)
url = "https://blog.csdn.net/javaldk"
driver.get(url)
source = driver.page_source
data = re.findall(re.compile('blog-list-box.*?<h4.*?>(.*?)<', re.S), source)
print(data)
element = driver.find_elements(By.CSS_SELECTOR, "article.blog-list-box")
element[1].click()
time.sleep(10)
driver.close()
|