爬虫01(滚动)
要求:爬虫数据网是向下滚动才能翻完一页的,不滚动鼠标只有半页那种。
# 第一步:自动登录首页并搜索,之后获取第一页的数据内容
is_first=True
def func1():
b.get('https://www.jd.com/')
time.sleep(2)
# 找到搜索图表,搜索手机,并回车
search_button=b.find_element_by_id('key')
search_button.send_keys('手机')
search_button.send_keys(Keys.ENTER)
time.sleep(2)
# 翻页
height=800
for _ in range(12):
b.execute_script(f'window.scrollTo(0,{height
爬虫01(滚动)最先出现在Python成神之路。
共有 0 条评论