ssundarraj / nittresults Goto Github PK
View Code? Open in Web Editor NEWPython script to get results of an entire class
Python script to get results of an entire class
Package the script for distribution.
Sometimes when the network is slow, or the server takes too long to reply, the following line gives an error:
el = driver.find_element_by_id('Dt1')
Because, the page is reloaded before this happens, and apparently the script keeps running without waiting for the page to reload. A simple fix - add wait()
every time elem.send_keys(Keys.RETURN)
is executed (in the latestSem
function), and modify the getGPA
function to this:
def getGPA(rno, sem_id_value):
elem = driver.find_element_by_name("TextBox1")
elem.send_keys(Keys.CONTROL, 'a')
elem.send_keys("\b")
elem.send_keys(rno)
elem.send_keys(Keys.RETURN)
wait()
el = driver.find_element_by_id('Dt1')
for option in el.find_elements_by_tag_name('option'):
if option.get_attribute('value') == sem_id_value:
option.click()
wait()
name = driver.find_element_by_id('LblName').text
gpa = driver.find_element_by_id('LblGPA').text
print(str(rno) + "\t" + name + "\t" + gpa) # Note the brackets - the only line that makes the original script incompatible with py3 is this one.
Here, wait()
can be defined to be time.sleep(1)
. Of course, 1 second might not be enough, so the user will probably still need to modify the script (but only the wait()
function).
Alternative is to somehow wait for the page to reload. I don't know how to do that in selenium. Haven't used it before. But this simple hack sufficed for me.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.