This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
emailInput.send_keys(self.email) | |
passwordInput.send_keys(self.password) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium.webdriver.common.keys import Keys | |
# ... | |
def signIn(self): | |
# ... | |
passwordInput.send_keys(Keys.ENTER) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from selenium.webdriver.common.keys import Keys | |
# ... | |
def signIn(self): | |
self.browser.get('https://www.instagram.com/accounts/login/') | |
emailInput = self.browser.find_elements_by_css_selector('form input')[0] | |
passwordInput = self.browser.find_elements_by_css_selector('form input')[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
import time | |
class InstagramBot(): | |
def __init__(self, email, password): | |
self.browser = webdriver.Chrome() | |
self.email = email | |
self.password = password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
followButton = self.browser.find_element_by_css_selector('button') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def followWithUsername(self, username): | |
self.browser.get('https://www.instagram.com/' + username + '/') | |
time.sleep(2) # not necessary | |
followButton = self.browser.find_element_by_css_selector('button') | |
followButton.click() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def followWithUsername(self, username): | |
self.browser.get('https://www.instagram.com/' + username + '/') | |
time.sleep(2) | |
followButton = self.browser.find_element_by_css_selector('button') | |
if (followButton.text != 'Following'): | |
followButton.click() | |
time.sleep(2) | |
else: | |
print("You are already following this user") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
import time | |
class InstagramBot(): | |
def __init__(self, email, password): | |
self.browserProfile = webdriver.ChromeOptions() | |
self.browserProfile.add_experimental_option('prefs', {'intl.accept_languages': 'en,en_US'}) | |
self.browser = webdriver.Chrome('chromedriver.exe', chrome_options=self.browserProfile) | |
self.email = email |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def __init__(self, email, password): | |
self.browserProfile = webdriver.ChromeOptions() | |
self.browserProfile.add_experimental_option('prefs', {'intl.accept_languages': 'en,en_US'}) | |
self.browser = webdriver.Chrome('chromedriver.exe', chrome_options=self.browserProfile) | |
self.email = email | |
self.password = password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getUserFollowers(self, username, max): | |
self.browser.get('https://www.instagram.com/' + username) | |
followersLink = self.browser.find_element_by_css_selector('ul li a') | |
followersLink.click() | |
time.sleep(2) | |
followersList = self.browser.find_element_by_css_selector('div[role=\'dialog\'] ul') | |
numberOfFollowersInList = len(followersList.find_elements_by_css_selector('li')) | |
followersList.click() | |
actionChain = webdriver.ActionChains(self.browser) |