I'm using Selenium with Firefox to drive the browser via Python script.
I need to access my Instagram account and, at the moment, I'm using the following code to connect:
class Insta:
def __init__(self, username, pw, text):
self.driver = webdriver.Firefox()
self.driver.get("http://instagram.com")
sleep(2)
#click ok on cookies
self.driver.find_element_by_xpath("/html/body/div[2]/div/div/div/div[2]/button[1]").click()
sleep(1)
self.driver.find_element_by_xpath("//input[@name=\"username\"]").send_keys(username)
self.driver.find_element_by_xpath("//input[@name=\"password\"]").send_keys(pw)
self.driver.find_element_by_xpath('//button[@type="submit"]').click()
The problem is every time I run the script it has to log in with the credentials.
I would like to know if there's a way to save or store the session information, as it happens when you click the "stay online" box on several websites so, after the very first time where I've to add the credentials, the following execution of the scripts don't need to iterate the process of login because the new session is already logged in the account
Thanks