def parse(self, response):
"""
Parses the first request and request the click event on the confirmation button
"""
self.driver.get(settings.request_url)
while True:
try:
next_req = self.driver.find_element_by_class_name('submit')
yield Request(settings.confirmation_url, callback=self.parse_callback)
next_req.click()
break
except Exception as err:
logging.error(err)
break
# Waiting to close browser... This gives enough time to download the file.
time.sleep(settings.sleep_time)
downloaded_file = get_download_folder() + '\\' + settings.downloaded_file_name
moved_file = settings.destination_path + settings.new_file_name
move_file(downloaded_file, moved_file)
delete_file(downloaded_file)
bova11_chrome_spider.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录