forked from Henry-Jia/python-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebcrawler.py
26 lines (19 loc) · 838 Bytes
/
webcrawler.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from selenium import webdriver
import time
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common import action_chains
# from selenium import webElement
driver=webdriver.Firefox()
rollno="2017UGCS026"
driver.get("https://nilekrator.pythonanywhere.com/rank")
# webDriver driver = new FirefoxDriver();
inpt = driver.find_element_by_xpath("//input[@name='roll']")
inpt.send_keys(rollno)
driver.find_element_by_xpath("/html/body/div[2]/div/div/form/div[2]/button").click()
time.sleep(5)
students= driver.find_elements_by_xpath("/html/body/div[2]/div[2]/div/div/div/div[4]/table/tbody/tr[1]/td[2]/span")
cgpa= driver.find_elements_by_xpath("/html/body/div[2]/div[2]/div/div/div/div[4]/table/tbody/tr[1]/td[3]")
num=len(students)
for i in range(num):
print(students[i].text+" : : "+cgpa[i].text)
driver.close();