Created
April 18, 2020 20:22
-
-
Save kmandana/dd7f39860b844887f024ae9182bd8d12 to your computer and use it in GitHub Desktop.
Sending Message
This file contains hidden or 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 send_likes(self, usernames): | |
| for username in usernames: | |
| url = 'https://www.instagram.com/' + username | |
| self.browser.get(url) | |
| button = self.browser.find_element_by_css_selector('button') | |
| if button.text == "Message": | |
| button.click() | |
| text_box = WebDriverWait(self.browser, 5).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "#react-root > section > div > div.Igw0E.IwRSH.eGOV_._4EzTm > div > div > div.DPiy6.Igw0E.IwRSH.eGOV_.vwCYk > div.uueGX > div > div.Igw0E.IwRSH.eGOV_._4EzTm > div > div > div.Igw0E.IwRSH.eGOV_.vwCYk.ItkAi > textarea"))) | |
| text_box.send_keys(self.msg) | |
| send_button = self.browser.find_element_by_css_selector('#react-root > section > div > div.Igw0E.IwRSH.eGOV_._4EzTm > div > div > div.DPiy6.Igw0E.IwRSH.eGOV_.vwCYk > div.uueGX > div > div.Igw0E.IwRSH.eGOV_._4EzTm > div > div > div.Igw0E.IwRSH.eGOV_._4EzTm.JI_ht > button') | |
| send_button.click() | |
| print('Message sent succesfully to", username) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment