-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSeleniumScraperforExam2.du.ac.in.py
More file actions
27 lines (27 loc) · 1.05 KB
/
SeleniumScraperforExam2.du.ac.in.py
File metadata and controls
27 lines (27 loc) · 1.05 KB
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
import os
from pyvirtualdisplay import Display
from selenium import webdriver as wb
import time
def create_ch_driver():
chrome_options = wb.ChromeOptions()
chrome_options.add_argument("--no-sandbox")
return wb.Chrome("/usr/local/bin/chromedriver", chrome_options=chrome_options)
#pathtochromedriver = '/Users/nipunarora/Desktop/django/webscraper&djangostart/seleniumscraper/chromedriver'### path to chromedriver Nipuns laptop
##ubuntu chromedriver path
################## A Virtual Display for VPS #########################
display = Display(visible=0, size=(800, 600))
display.start()
print "Display Started"
driver = create_ch_driver()
print "driver executed"
driver.get('http://duexam2.du.ac.in/RSLT_ND2016/Students/List_Of_Declared_Results.aspx')
a=driver.find_element_by_id("gvshow_ata_glance_ctl05_btn_show_details")
a.click()
print "Clicked"
time.sleep(20)
current_page_source=open("Pagesource1.html","a+")
current_page_source.write(driver.page_source.encode('utf-8'))
current_page_source.close()
print "Completed Successfully"
driver.quit()
display.stop()