Just because,
I'll be around to answer questions.
PhantomJS | PhantomJS
Selenium - Web Browser Automation
Code:import json from selenium import webdriver class gaiaonline(object): """Selenium driver for gaiaonline login""" def __init__(self): """Create driver and store some urls""" self.driver = webdriver.PhantomJS() self.home = 'http://gaiaonline.com/' self.auth = self.home + 'auth' self.GSI = self.home + 'chat/gsi/?' def login(self,username, password): """Use webdriver to login""" self.driver.get(self.auth) self.driver.find_element_by_id("username").send_keys(username) self.driver.find_element_by_id("password").send_keys(password) self.driver.find_element_by_id('signInButton').click() print(self.driver.current_url) def getSID(self): """Grab sid from gsi109""" url = self.GSI + 'v=json&m=[[109]]' self.driver.get(url) return(json.loads(self.driver.find_element_by_tag_name('pre').text)[0][2]) def main(): b = gaiaonline() b.login('username','password') print(b.getSID()) if __name__ == '__main__': main()
Results 1 to 6 of 6
Threaded View
- 11 Sep. 2015 02:16pm #1
- Join Date
- Apr. 2013
- Location
- Minnesota
- Posts
- 1,325
- Reputation
- 114
- LCash
- 0.00
[python] Gaiaonline Login Script -- Selenium & PhantomJS