MCPcopy
hub / github.com/wistbean/learn_python3_spider / next_page

Function next_page

ikun_basketball.py:59–71  ·  view source on GitHub ↗
(page_num)

Source from the content-addressed store, hash-verified

57
58
59def next_page(page_num):
60 try:
61 print('获取下一页数据')
62 next_btn = WAIT.until(EC.element_to_be_clickable((By.CSS_SELECTOR,
63 '#all-list > div.flow-loader > div.page-wrap > div > ul > li.page-item.next > button')))
64 next_btn.click()
65 WAIT.until(EC.text_to_be_present_in_element((By.CSS_SELECTOR,
66 '#all-list > div.flow-loader > div.page-wrap > div > ul > li.page-item.active > button'),
67 str(page_num)))
68 get_source()
69 except TimeoutException:
70 browser.refresh()
71 return next_page(page_num)
72
73
74def save_to_excel(soup):

Callers 1

mainFunction · 0.85

Calls 1

get_sourceFunction · 0.85

Tested by

no test coverage detected