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
- 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
- 24 Jan. 2016 05:28pm #2
Might be a dumb question but any particular reason for the chat/gsi endpoint?
edit: nvm, I see you later use that url to access some JSON data, can I ask what exactly the SID is useful for though?Last edited by ZeusJuice; 24 Jan. 2016 at 05:35pm.
- 24 Jan. 2016 07:21pm #3
- 14 May. 2016 10:37pm #4
You can use this for Java, correct?
- 31 May. 2016 03:19pm #5
- Join Date
- Apr. 2013
- Location
- Minnesota
- Posts
- 1,325
- Reputation
- 114
- LCash
- 0.00
- 11 Feb. 2018 11:45am #6
how does this work? <3