следует начать:
from selenium import webdriver
from bs4 import BeautifulSoup as bs
import time
url = 'https://old.mciindia.org/InformationDesk/IndianMedicalRegister.aspx'
driver = webdriver.Chrome('C:/chromedriver_win32/chromedriver.exe')
driver.get(url)
driver.find_element_by_xpath("//a[contains(text(),'Year of Registration')]").click()
driver.find_elements_by_css_selector("input[type='text']")[-1].send_keys("2015")
driver.find_element_by_css_selector("input[value='Submit']").click()
soup = bs(driver.page_source, 'html.parser')
table = soup.find('table',{'id':'dnn_ctr588_IMRIndex_GV_Search'})
headers = [ header.text.strip() for header in table.find_all('th') ]
next_page = True
while next_page == True:
soup = bs(driver.page_source, 'html.parser')
table = soup.find('table',{'id':'dnn_ctr588_IMRIndex_GV_Search'})
rows = table.find_all('tr')
for row in rows:
if len(row.find_all('td')) == 7:
data = row.find_all('td')
name = data[4].text.strip()
root_url = data[6].a['href'].split("'")[1]
id_url = data[6].a['href'].split("'")[3]
link = root_url + 'ViewDetails.aspx?ID=' + id_url
print ('Name: %-50s\t Link: %s' %(name, link))
time.sleep(5)
try:
driver.find_element_by_xpath("//a[contains(text(),'Next')]").click()
except:
print ('No more pages')
next_page=False
driver.close()