from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
class InstagramBot:
def __init__(self, username, password):
self.username = username
self.password = password
self.driver = webdriver.Chrome('C:Program Files (x86)chromedriver.exe')
def CloseBrowser(self):
self.driver.close
def Login(self):
driver = self.driver
driver.get('https://instagram.com/')
sleep(1)
username_input = driver.find_element_by_xpath('//input[@name="username"]')
username_input.send_keys(self.username)
sleep(2)
password_input = driver.find_element_by_xpath('//input[@name="password"]')
password_input.send_keys(self.password)
sleep(1)
button = driver.find_element_by_xpath('//button[@type="submit"]')
button.click()
bot1 = InstagramBot()
bot1.Login()