login a webpage using python and display the result in the browser
Question: I'm a beginner in python and as a learning project i decided to just make a
little script to lunch a webpage and log into it. Now after doing lots of
googling (got many messy bits and piece of knowlegde) i found out that each
website have it own way of handling login requests, and that there was many
ways to emulate an instance of a browser to retrieve and post data ( urllib2,
selenium, twill and blablabla).

So I know it is possible to log in into a website from python ( for a specific
site and using a specific way) but I can't seem to display the logged page in
a browser.

Can anyone help me please ?


Answer: I think selenium can do this job.

code snippet:

    
    
    from selenium import webdriver 
    from selenium.common.exceptions import NoSuchElementException 
    from selenium.webdriver.common.keys import Keys
    
    browser = webdriver.Firefox() # Get local session of firefox 
    browser.get(yoursite) # Load page 
    elem = browser.find_element_by_name("email") # Find the query box 
    elem.send_keys(email) 
    
    ps = browser.find_element_by_name("password") # Find the query box 
    ps.send_keys(passwd + Keys.RETURN)
    

this piece of code will drive your firefox to open the logged page.

