Skip to content

Commit 8bd2b35

Browse files
authored
Treat cookie request post login (#40)
1 parent 6f0094d commit 8bd2b35

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

instadm.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class InstaDM(object):
1717
def __init__(self, username, password, headless=True, instapy_workspace=None, profileDir=None):
1818
self.selectors = {
1919
"accept_cookies": "//button[text()='Allow essential and optional cookies']",
20+
"accept_cookies_post_login": "//button[text()='Allow all cookies']",
2021
"home_to_login_button": "//button[text()='Log In']",
2122
"username_field": "username",
2223
"password_field": "password",
@@ -102,6 +103,9 @@ def login(self, username, password):
102103
self.__random_sleep__()
103104
if self.__wait_for_element__(self.selectors['login_check'], 'xpath', 10):
104105
print('Login Successful')
106+
if self.__wait_for_element__(self.selectors['accept_cookies_post_login'], 'xpath', 10):
107+
self.__get_element__(self.selectors['accept_cookies_post_login'], 'xpath').click()
108+
self.__random_sleep__(2, 4)
105109
else:
106110
print('Login Failed: Incorrect credentials')
107111

0 commit comments

Comments
 (0)