Skip to content

Instantly share code, notes, and snippets.

@cryskram
Created March 25, 2021 09:58
Show Gist options
  • Save cryskram/f95661b0a3ead7d5f04c402b7e0c6a40 to your computer and use it in GitHub Desktop.
Save cryskram/f95661b0a3ead7d5f04c402b7e0c6a40 to your computer and use it in GitHub Desktop.
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from getpass import getpass
username = input('whitehowie7@gmail.com')
password = getpass('#########')
driver = webdriver.Chrome()
url = 'https://www.instagram.com/'
driver.get(url)
try:
userbox = WebDriverWait(driver, 10).until(
EC.presence_of_element_located(
(By.XPATH, "/html/body/div[1]/section/main/article/div[2]/div[1]/div/form/div/div[1]/div/label/input"))
)
userbox.click()
userbox.send_keys(username)
passbox = WebDriverWait(driver, 10).until(
EC.presence_of_element_located(
(By.XPATH, "/html/body/div[1]/section/main/article/div[2]/div[1]/div/form/div/div[2]/div/label/input"))
)
passbox.click()
passbox.send_keys(password)
# add more code here
finally:
driver.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment