import requests import lxml.html as lh import pandas as pd from webdriver_manager.chrome import ChromeDriverManager from selenium import webdriver import time driver = webdriver.Chrome(ChromeDriverManager().install()) web=driver.get('https://www.hec.gov.pk/english/universities/pages/recognised.aspx#k=') i='1' col=[] time.sleep(5) for page in range(1,24): i=str(int(i)+1) button=driver.find_element_by_link_text(i) button.click() time.sleep(5) url=driver.current_url page=requests.get(url) doc=lh.fromstring(page.content) tr_elements = doc.xpath('//tr/td[5]') for t in tr_elements: name=t.text_content() col.append(name) print(col)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)