-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselenium_module.py
More file actions
32 lines (30 loc) · 987 Bytes
/
selenium_module.py
File metadata and controls
32 lines (30 loc) · 987 Bytes
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
27
28
29
30
31
32
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import re,time
from selenium import webdriver
def main():
fp = open("name.txt" , "w+")
driver = webdriver.Firefox()
driver.get("http://results.cusat.ac.in/regforms/regno1.php")
regno = driver.find_element_by_name("rno")
regno.clear()
button = driver.find_element_by_xpath("/html/body/form/table/tbody/tr[4]/td/input")
for i in range(12180000,12180094):
name_regex = re.compile(r'<b>\w+ (\w+)?')
regno.send_keys(str(i))
button = driver.find_element_by_xpath("/html/body/form/table/tbody/tr[4]/td/input")
button.click()
time.sleep(10)
name = name_regex.search(driver.page_source)
name_final = name.group().split('>')
print (name_final[1])
fp.write(name_final[1])
driver.back()
regno = driver.find_element_by_name("rno")
regno.clear()
time.sleep(4)
fp.close()
main()