Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send multiple lines #34 + bug #43 #46

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions instadm.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def typeMessage(self, user, message):
self.__random_sleep__()

if self.__wait_for_element__(self.selectors['send'], "xpath"):
self.__remove_browser_unsupported_banner_if_exists(self, element):
self.__remove_browser_unsupported_banner_if_exists()
self.__get_element__(self.selectors['send'], "xpath").click()
self.__random_sleep__(3, 5)
print('Message sent successfully')
Expand Down Expand Up @@ -327,7 +327,11 @@ def __type_slow__(self, element_tag, locator, input_text=''):
actions = ActionChains(self.driver)
actions.click(element).perform()
for s in input_text:
element.send_keys(s)
# https://stackoverflow.com/questions/53901388/how-do-i-manipulate-shiftenter-instead-of-n/53909017#53909017
if s == '\n':
element.send_keys(Keys.SHIFT, s)
else:
element.send_keys(s)
sleep(uniform(0.25, 0.75))

except Exception as e:
Expand All @@ -346,7 +350,7 @@ def teardown(self):
self.driver.close()
self.driver.quit()

def __remove_browser_unsupported_banner_if_exists(self, element):
def __remove_browser_unsupported_banner_if_exists(self):
element = self.__get_element__('rh7Wz', 'CLASS')
if element is not None:
self.driver.execute_script("""
Expand Down