from selenium import webdriver标签:XPATH,text,value,find,爬取,li,动态,id From: https://www.cnblogs.com/txa2003/p/16951993.html
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import time
e=webdriver.Edge()
z=1
e.get('https://www.qidian.com/all/')
name=e.find_elements(By.XPATH,value='//*[@id="book-img-text"]/ul/li/div[2]/h2/a')
author=e.find_elements(By.XPATH,value='//*[@id="book-img-text"]/ul/li/div[2]/p[1]/a[1]')
side=e.find_elements(By.XPATH,value='//*[@id="book-img-text"]/ul/li/div[2]/p[1]/a[2]')
for i in range(5):
for a,b,c in zip(name,author,side):
with open('起点书名作者.txt', 'a', encoding='utf-8') as f:
f.write(str(z)+a.text+' '+b.text+' '+c.text+'\n')
# print('正在存储'+str(z)+a.text+' '+b.text+' '+c.text+'\n')
z = z+1
i=e.find_element(By.XPATH,value='//*[@id="page-container"]/div/ul/li[7]/a')