from time import sleep
from selenium import webdriver
import random
chrome = webdriver.Chrome()
next_urls=["https://blog.csdn.net/weixin_42218868/article/details/95383428",
"https://blog.csdn.net/weixin_42218868/article/details/95398043",
'https://blog.csdn.net/weixin_42218868/article/details/95380683',
"https://blog.csdn.net/weixin_42218868/article/details/95379800",
"https://blog.csdn.net/weixin_42218868/article/details/95343987",
'https://blog.csdn.net/weixin_42218868/article/details/95339149'
]
#实例化一个浏览器驱动
#访问页面
i=0
while True:
chrome.get(next_urls[i%6])
xiawen = chrome.find_elements_by_xpath("//a[@class='btn-readmore']")
a=random.uniform(0,1)
sleep(a)
print(a)
try:
xiawen[0].click()
except:
print('没有查看下文')
else:
print('查看下文')
b = random.uniform(1, 3)
sleep(b)
i+=1
csdn访问量如何增加Python
最新推荐文章于 2019-12-31 09:46:55 发布